In my never-ending quest for automation of the daily work we do, and the ability to PROFIT by not reinventing the wheel each and every time we do something, I have found a couple of very handy utilities for working with JSON data. The first one, listed below, can be used for any language, etc, because it’s just visualizing JSON data. The second utility is for generating Java (Android) classes for dealing with it. Take a look and let me know your thoughts…

http://jsonviewer.stack.hu/

Just post this and you’ll see what it does. I also just downloaded a class/form generator that will parse the json url and create the class for it. Very cool.

…and the code generator (attached JAR file) created this by using the attached JAR file. This is a Java app, and you can simply double click on the JAR file to run it.:

public class YourClass extends Activity {

public static final String url=”http://pbsdcrmapi.palmbeachsoftware.com/api/crm/GetCompanyById/1″;
public static final String TAG_ACTIVE=”Active”;
public static final String TAG_COMPANYLOCATION=”CompanyLocation”;
public static final String TAG_COMPANYTYPE=”CompanyType”;
public static final String TAG_COMPANYTYPEID=”CompanyTypeId”;
public static final String TAG_DATEMODIFIED=”DateModified”;
public static final String TAG_PRIMARYLOCATIONID=”PrimaryLocationId”;
public static final String TAG_COMPANYID=”CompanyId”;
public static final String TAG_CREATEDBYID=”CreatedById”;
public static final String TAG_DATECREATED=”DateCreated”;
public static final String TAG_MODIFIEDBYID=”ModifiedById”;
public static final String TAG_COMPANYLOCATIONS=”CompanyLocations”;
public static final String TAG_COMPANYNAME=”CompanyName”;

JSONParser jParser = new JSONParser();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
JSONObject json = jParser.getJSONFromUrlByGet(url);
try {

String str_Active = json.getString(TAG_ACTIVE);

String str_CompanyLocation = json.getString(TAG_COMPANYLOCATION);

String str_CompanyType = json.getString(TAG_COMPANYTYPE);

String str_CompanyTypeId = json.getString(TAG_COMPANYTYPEID);

String str_DateModified = json.getString(TAG_DATEMODIFIED);

String str_PrimaryLocationId = json.getString(TAG_PRIMARYLOCATIONID);

String str_CompanyId = json.getString(TAG_COMPANYID);

String str_CreatedById = json.getString(TAG_CREATEDBYID);

String str_DateCreated = json.getString(TAG_DATECREATED);

String str_ModifiedById = json.getString(TAG_MODIFIEDBYID);

String str_CompanyLocations = json.getString(TAG_COMPANYLOCATIONS);

String str_CompanyName = json.getString(TAG_COMPANYNAME);

} catch (JSONException e){
}
}
}