Skip to content

Instantly share code, notes, and snippets.

@msomu
Created October 12, 2014 05:52
Show Gist options
  • Save msomu/fe918a2d20ca85935f9f to your computer and use it in GitHub Desktop.
Save msomu/fe918a2d20ca85935f9f to your computer and use it in GitHub Desktop.
JSON Parsing For Android
try{
JSONObject jsonObject = new JSONObject(s);
JSONObject propertiesObject = jsonObject.getJSONObject("properties");
JSONObject idObject = propertiesObject.getJSONObject("id");
String s1 = idObject.getString("type");
Log.d("Type",s1);
}
{
name: "Product",
properties: {
id: {
type: "number",
description: "Product identifier",
required: true
},
name: {
description: "Name of the product",
type: "string",
required: true
},
price: {
type: "number",
minimum: 0,
required: true
},
tags: {
type: "array",
items: {
type: "string"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment