My service(written in Java) returns me an output in the format:
"serviceMetricList":
[
{"MetricDataList":
{"metricDataList":
[
{"metricDate": "2011-04-05T14:50:00.000Z",
"metricValue": "427448.0"},
{"metricDate": "2011-04-12T14:30:00.000Z",
"metricValue": "430089.0"}
]
},
"urlSerialNo": "1"}
}
]
I need to retrieve the values metricDate and metricValue from my Ruby client. Am not sure about how this can be done. Any help in this regard will be great.
If you want to parse this data format, you first need to know what data format it is. It doesn’t appear to be any well-known data format and it’s not any format I know. It’s obviously not JSON, nor is it YAML and definitely not XML.
So, you’ll probably have to write your own parser. Or a preprocessor which converts the data into a more well-known format, for wich a parser already exists.
For example, if you were to convert the example to YAML, it would look something like this:
And you could parse it like this: