sql >> Base de Datos >  >> NoSQL >> MongoDB

Parse.com agrega el objeto JSON a la matriz JSON

Intenta usar object.toString() en lugar de object .

lan.add("Participants", object.toString());

JSON:

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

Para analizar este JSON, intente esto:

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 esto ayude~