Hi Jingahr,
You can easily fetch specific key from App42 using Storage API. Please refer following code snippet, that will help you in parsing.
public static void loadApp42Contacts1() {
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");
StorageService storageService=App42API.buildStorageService();
Set<String> selectKeys = new HashSet<String>();
selectKeys.add("Key");
storageService.setSelectKeys(selectKeys);
storageService.findAllDocuments("YourDBName",
"YourCollectionName", new App42CallBack() {
@Override
public void onSuccess(Object arg0) {
// TODO Auto-generated method stub
parseData(((Storage) arg0)
.getJsonDocList());
}
@Override
public void onException(Exception arg0) {
// TODO Auto-generated method stub
}
});
}
private static void parseData(ArrayList<JSONDocument> jsonDocList){
for(JSONDocument userJsonDoc:jsonDocList){
try {
JSONObject jsonData=new JSONObject(userJsonDoc.jsonDoc);
System.out.println(jsonData.toString());
System.out.println(jsonData.opt("Key"));
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
Let me know if it helps.
Thanks
Vishnu Garg