I was looking up the JsonObject class in Java: http://docs.oracle.com/javaee/7/api/javax/json/JsonObject.html
I was trying to figure out how to take an object which I created and return it as a string. See below:
public String toJson ()
{
JsonObject data = Json.createObjectBuilder();
//this._myMap is just the private map variable defined: <String, FooClass>
for ( Entry<String, FooClass> tuple : this._myMap.entrySet() )
{
data.add(type.getKey(), tuple.getValue().toString());
}
data.build();
// String out = ...?
return "-1";
}
after first glance of the documentation, there isnt a toStyledString, or anything which would return a string, so i was curious as to how to approach it. Im thinking that i could just do something with Json.createWriter
or equivalent, but was not sure.