This question is related to https://stackoverflow.com/questions/32363315/gson-fields-that-sometimes-are-strings-and-others-arrays

I'm parsing json with Gson but I'm struggling with the data I'm getting. This is part of an API out of my control (openFDA) so changing that might not be an option.

Here's the json I'm strugling with: https://api.fda.gov/device/event.json?search=device.generic_name:generator&limit=10

There are some fields that are not consistent, for example remedial_action. Sometimes it comes out like this:

"remedial_action": [

and in other results like this:

"remedial_action": ""

So it's either an array or a plain string. Looks like a bug to me. But I'm a json newbie.



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.