I have been trying to follow along with this solution How to find specified name and its value in JSON-string from Java?
However it does not seem to make sense.
I define a new gson object from a string:
Example of string here: http://api.soundrop.fm/spaces/XJTt3mXTOZpvgmOc
public void convertToJson()
{
Gson gson = new Gson();
Object gsonContent = gson.fromJson( stringContent, RadioContent.class );
}
And then try and return a value:
public Object getValue( String find )
{
return gsonContent.find;
}
Finally its called with:
public static void print( String find = "title" )
{
Object value = radioContent.getValue( find );
System.out.println( value );
}
However I am getting an error:
java: cannot find symbol
symbol: variable find
location: variable gsonContent of type java.lang.Object
Full classes: Main class: http://pastebin.com/v4LrZm6k Radio class: http://pastebin.com/2BWwb6eD