[
https://issues.apache.org/jira/browse/METAMODEL-38?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14047230#comment-14047230
]
Kasper Sørensen commented on METAMODEL-38:
------------------------------------------
Actually I was also looking into this now because I had a customer request that
we use JSON as a source for our MetaModel-based application .. Their data is in
the form like this:
{code}
[
{"id":1, ...},
{"id":2, ...},
{"id":3, ...},
...
]
{code}
And I found out that Jackson (the JSON library we also use in a lot of other
scenarios, incl. the MetaModel couchdb module) can parse this in a streaming
fashion like this:
{code}
final JsonFactory factory = new MappingJsonFactory();
final JsonParser parser = factory.createJsonParser(source);
JsonToken token = null;
do {
token = parser.nextToken();
if (token == JsonToken.START_OBJECT) {
Map<?, ?> map = parser.readValueAs(Map.class);
System.out.println("map: " + map);
}
} while (token != null);
{code}
> JSON file based DataContext model
> ---------------------------------
>
> Key: METAMODEL-38
> URL: https://issues.apache.org/jira/browse/METAMODEL-38
> Project: Metamodel
> Issue Type: Improvement
> Reporter: Joao Boto
>
> Could we support the json file format..
> Json is not unlike xml which is already supported however is a much condensed
> form, and it is being used as the preferred method of exchange for many API
> one example:
> {
> "name":{
> "first":"Joe",
> "last":"Sixpack"
> },
> "gender":"MALE",
> "verified":false,
> "userImage":"Rm9vYmFyIQ=="
> }
--
This message was sent by Atlassian JIRA
(v6.2#6252)