MongoDB
 sql >> Base de Dados >  >> NoSQL >> MongoDB

Parse.com adiciona objeto JSON à matriz JSON


Tente usar object.toString() em vez de object .
lan.add("Participants", object.toString());

JSON:
{"Participants":["{\"PlayerName\":\"John\",\"ID\":514145}"]}

Para analisar este JSON, tente isto:
JSONObject jsonObj = new JSONObject(YOUR_JSON_STRING);

// Participants
JSONArray participantsJsonArray = jsonObj.getJSONArray("Participants");

// Participant
JSONObject participanJsonObject = participantsJsonArray.getJSONObject(0);

// PlayerName
String playerName = participanJsonObject.getString("PlayerName");
// ID
String id = participanJsonObject.getInt("ID");

Espero que isso ajude~