I get this JSON returned and i want to select the metadata "Title" so i can change it to something else.
{
"d": {
"results": [
{
"__metadata": {
"id": "a8d82500-b17d-43fc-9d03-ee95c498d374",
"uri": "http:/industrial-ex/sites/tifdemo/_api/Web/Lists(guid'64623cd3-3c4b-4e79-9e94-3e69059903f2')/Items(6)",
"etag": "\"33\"",
"type": "SP.Data.EnoviaItem"
},
"FirstUniqueAncestorSecurableObject": {
"__deferred": {
"uri": "http:/industrial-ex/sites/tifdemo/_api/Web/Lists(guid'64623cd3-3c4b-4e79-9e94-3e69059903f2')/Items(6)/FirstUniqueAncestorSecurableObject"
}
},
"RoleAssignments": {
"__deferred": {
"uri": "http:/industrial-ex/sites/tifdemo/_api/Web/Lists(guid'64623cd3-3c4b-4e79-9e94-3e69059903f2')/Items(6)/RoleAssignments"
}
},
"AttachmentFiles": {
"__deferred": {
"uri": "http:/industrial-ex/sites/tifdemo/_api/Web/Lists(guid'64623cd3-3c4b-4e79-9e94-3e69059903f2')/Items(6)/AttachmentFiles"
}
},
"ContentType": {
"__deferred": {
"uri": "http:/industrial-ex/sites/tifdemo/_api/Web/Lists(guid'64623cd3-3c4b-4e79-9e94-3e69059903f2')/Items(6)/ContentType"
}
},
"FieldValuesAsHtml": {
"__deferred": {
"uri": "http:/industrial-ex/sites/tifdemo/_api/Web/Lists(guid'64623cd3-3c4b-4e79-9e94-3e69059903f2')/Items(6)/FieldValuesAsHtml"
}
},
"FieldValuesAsText": {
"__deferred": {
"uri": "http:/industrial-ex/sites/tifdemo/_api/Web/Lists(guid'64623cd3-3c4b-4e79-9e94-3e69059903f2')/Items(6)/FieldValuesAsText"
}
},
"FieldValuesForEdit": {
"__deferred": {
"uri": "http:/industrial-ex/sites/tifdemo/_api/Web/Lists(guid'64623cd3-3c4b-4e79-9e94-3e69059903f2')/Items(6)/FieldValuesForEdit"
}
},
"File": {
"__deferred": {
"uri": "http:/industrial-ex/sites/tifdemo/_api/Web/Lists(guid'64623cd3-3c4b-4e79-9e94-3e69059903f2')/Items(6)/File"
}
},
"Folder": {
"__deferred": {
"uri": "http:/industrial-ex/sites/tifdemo/_api/Web/Lists(guid'64623cd3-3c4b-4e79-9e94-3e69059903f2')/Items(6)/Folder"
}
},
"ParentList": {
"__deferred": {
"uri": "http:/industrial-ex/sites/tifdemo/_api/Web/Lists(guid'64623cd3-3c4b-4e79-9e94-3e69059903f2')/Items(6)/ParentList"
}
},
"FileSystemObjectType": 0,
"Id": 6,
"ID": 6,
"ContentTypeId": "0x010100B54C4134C49AE4429841FEE843FEF1D0",
"Created": "2015-02-11T08:04:27Z",
"AuthorId": 1073741823,
"Modified": "2015-02-11T16:37:09Z",
"EditorId": 1,
"OData__CopySource": null,
"CheckoutUserId": null,
"OData__UIVersionString": "1.0",
"GUID": "5b5f67c9-5ad6-499c-8799-f91baa7a31df",
"Title": "test"
}
]
}
}
Here is the Java code i got right now to GET the JSON format.
String url = "http://industrial-ex/sites/tifdemo/_api/web/lists/getbytitle('enovia')/Items";
GetMethod get = new GetMethod(url);
get.setRequestHeader("Accept", "application/json; odata=verbose;");
authentication.getHttpClient().executeMethod(get);
JsonParser p = new JsonParser();
JsonElement jsonElement = p.parse(get.getResponseBodyAsString());
JsonObject asJsonObject = jsonElement.getAsJsonObject();
System.out.println("JSON OBJECT: " + asJsonObject);
String title = asJsonObject.get("d").toString();
System.out.println("---RESULT---: " + title);</code>