libgdx/libgdx — pull request #332 by Phibedy (2013-04-03 17:41:50+00:00)
Title: write json without json.tojson(...) 

My first attempt failed, that one is tested and works :)
How to create json:
public static Json writeTest(Json json, Test t){
json.initialzeJsonWriter();
json.writeObjectStart();
json.writeObjectStart("tester");
json.writeValue("className", t.getClass().getName(), String.class);
json.writeValue("test", t, t.getClass());
json.writeObjectEnd();
json.writeObjectEnd();
return json;
}
How to get String:
writeTest(json, test).getString();
to prettyprint it:
json.prettyPrint(writeTest(json, test).getString(),0);

I think that's quite usefull if you don't have an object, but want to create a json.
best regards