Reputation: 394
I'm trying to parse a array almost like a JSON type like response from an API.
Notice that I can't change or modify the structure of this response.
Maybe someone has an idea of what type is this. I mention that I've searched on google and failed to find a concrete answer to my question.
Here is the response that comes as a string type:
[
{
name=David,
age=7
},
{
name=John,
age=7
},
..
..
..
]
Thanks
Upvotes: 2
Views: 123
Reputation: 975
You could do some replacements in the result to turn it in to valid JSON
then use Json.net
to parse, but that may prove to be just as complicated as writing your own parser depending on the possible data that you could get back. If this is the standard response then you could add a quote at the beginning of each line, add a quote before the commas, and then replace the = with ":"
. After doing that it it would be legal JSON
. If the data varies too much though I think I'd recommend a custom parser where you could program for all variations, as my proposed solution isn't very flexible.
Upvotes: 2
Reputation: 9650
It looks a little like JSON, but it is not valid JSON. I guess you'll have two approaches to deal with this:
I think I would use the former.
Upvotes: 2