I have a string:
[{"product_id":"2","name":'stack"'},{"product_id":"2","name":"overflow"}]"
How can I use Flexjson's JSONDeserializer to obtain all product_id
s from the above string?
I have a class called productinformation
which has fields like product_id
and name
.
You could use the
JSONDeserializer.use()
methods to tell it how to deserialize the array and each object in the array, in this case of classProductInformation
. The product_id attribute does not match up with the standard naming that flexjson expects, so your properties on the object will need to have an underscore in them.The section on "Deserialization Without the Training Wheels" in Deserialization section of the docs goes into additional details on the other cases to consider if the type information is not included in the JSON string.