You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Manula Thantriwatte <ma...@gmail.com> on 2014/03/12 13:09:47 UTC
Error in unmarshalling after removing root element from input json
Hi All,
I want to parse the JSON string which haven't root element. When I google I
found there is a configurations to dropRootElement. This is work for me for
the output json. But it didn't work for the input json. How can I solve
this problem. Here I attach my sample JSON file.
{
"ref": "refs/heads/master",
"after": "a6abbdeaf4b7b29b646501583d408f16a033a975",
"before": "244d9eeeb5de42ed078bc469d82a99106de28d87",
"created": false,
"deleted": false,
"forced": false,
"compare": "https://github.com/manulachathurika/stratos2-test/compare/244d9eeeb5de...a6abbdeaf4b7",
"commits": [
{
"id": "a6abbdeaf4b7b29b646501583d408f16a033a975",
"distinct": true,
"message": "Test",
"timestamp": "2014-03-12T14:04:31+05:30",
"url": "https://github.com/manulachathurika/stratos2-test/commit/a6abbdeaf4b7b29b646501583d408f16a033a975",
"author": {
"name": "Manula Thantriwatte",
"email": "manula@apache.org",
"username": "manulachathurika"
},
"committer": {
"name": "Manula Thantriwatte",
"email": "manula@apache.org",
"username": "manulachathurika"
},
"added": [
],
"removed": [
],
"modified": [
"www/sleep.php"
]
}
],
"head_commit": {
"id": "a6abbdeaf4b7b29b646501583d408f16a033a975",
"distinct": true,
"message": "Test",
"timestamp": "2014-03-12T14:04:31+05:30",
"url": "https://github.com/manulachathurika/stratos2-test/commit/a6abbdeaf4b7b29b646501583d408f16a033a975",
"author": {
"name": "Manula Thantriwatte",
"email": "manula@apache.org",
"username": "manulachathurika"
},
"committer": {
"name": "Manula Thantriwatte",
"email": "manula@apache.org",
"username": "manulachathurika"
},
"added": [
],
"removed": [
],
"modified": [
"www/sleep.php"
]
},
"repository": {
"id": 17658115,
"name": "stratos2-test",
"url": "https://github.com/manulachathurika/stratos2-test",
"description": "Stratos2 Test",
"watchers": 0,
"stargazers": 0,
"forks": 0,
"fork": true,
"size": 112,
"owner": {
"name": "manulachathurika",
"email": "manulachathurika@gmail.com"
},
"private": false,
"open_issues": 0,
"has_issues": false,
"has_downloads": true,
"has_wiki": true,
"language": "PHP",
"created_at": 1394607356,
"pushed_at": 1394613293,
"master_branch": "master"
},
"pusher": {
"name": "manulachathurika",
"email": "manulachathurika@gmail.com"
}}
I want to get the repository details. In this JSON there isn't root
element. I need to know how to get repository details in this JSON
file.
Thanks !
--
Regards,
Manula Thantriwatte.
Re: Fwd: Error in unmarshalling after removing root element from
input json
Posted by Manula Thantriwatte <ma...@gmail.com>.
Hi Sergey,
Thanks ! It works !
On Wed, Mar 12, 2014 at 6:11 PM, Sergey Beryozkin <sb...@gmail.com>wrote:
> Hi
>
> Please check
> http://cxf.apache.org/docs/jax-rs-data-bindings.html#JAX-RSDataBindings-
> WrappingandUnwrappingJSONsequences
>
> or try JacksonJsonProvider (non JAXB variant), I think it can unmarshall
> the root-less sequence directly into a bean
>
> Cheers, Sergey
>
>
>
> On 12/03/14 12:15, Manula Thantriwatte wrote:
>
>> Hi All,
>>
>> I want to parse the JSON string which haven't root element. When I google
>> I
>> found there is a configurations to dropRootElement. This is work for me
>> for
>> the output json. But it didn't work for the input json. How can I solve
>> this problem. Here I attach my sample JSON file.
>>
>> {
>> "ref": "refs/heads/master",
>> "after": "a6abbdeaf4b7b29b646501583d408f16a033a975",
>> "before": "244d9eeeb5de42ed078bc469d82a99106de28d87",
>> "created": false,
>> "deleted": false,
>> "forced": false,
>> "compare": "https://github.com/manulachathurika/stratos2-
>> test/compare/244d9eeeb5de...a6abbdeaf4b7",
>> "commits": [
>> {
>> "id": "a6abbdeaf4b7b29b646501583d408f16a033a975",
>> "distinct": true,
>> "message": "Test",
>> "timestamp": "2014-03-12T14:04:31+05:30",
>> "url": "https://github.com/manulachathurika/stratos2-test/commit/
>> a6abbdeaf4b7b29b646501583d408f16a033a975",
>> "author": {
>> "name": "Manula Thantriwatte",
>> "email": "manula@apache.org",
>> "username": "manulachathurika"
>> },
>> "committer": {
>> "name": "Manula Thantriwatte",
>> "email": "manula@apache.org",
>> "username": "manulachathurika"
>> },
>> "added": [
>>
>> ],
>> "removed": [
>>
>> ],
>> "modified": [
>> "www/sleep.php"
>> ]
>> }
>> ],
>> "head_commit": {
>> "id": "a6abbdeaf4b7b29b646501583d408f16a033a975",
>> "distinct": true,
>> "message": "Test",
>> "timestamp": "2014-03-12T14:04:31+05:30",
>> "url": "https://github.com/manulachathurika/stratos2-test/commit/
>> a6abbdeaf4b7b29b646501583d408f16a033a975",
>> "author": {
>> "name": "Manula Thantriwatte",
>> "email": "manula@apache.org",
>> "username": "manulachathurika"
>> },
>> "committer": {
>> "name": "Manula Thantriwatte",
>> "email": "manula@apache.org",
>> "username": "manulachathurika"
>> },
>> "added": [
>>
>> ],
>> "removed": [
>>
>> ],
>> "modified": [
>> "www/sleep.php"
>> ]
>> },
>> "repository": {
>> "id": 17658115,
>> "name": "stratos2-test",
>> "url": "https://github.com/manulachathurika/stratos2-test",
>> "description": "Stratos2 Test",
>> "watchers": 0,
>> "stargazers": 0,
>> "forks": 0,
>> "fork": true,
>> "size": 112,
>> "owner": {
>> "name": "manulachathurika",
>> "email": "manulachathurika@gmail.com"
>> },
>> "private": false,
>> "open_issues": 0,
>> "has_issues": false,
>> "has_downloads": true,
>> "has_wiki": true,
>> "language": "PHP",
>> "created_at": 1394607356,
>> "pushed_at": 1394613293,
>> "master_branch": "master"
>> },
>> "pusher": {
>> "name": "manulachathurika",
>> "email": "manulachathurika@gmail.com"
>> }}
>>
>>
>> I want to get the repository details. In this JSON there isn't root
>> element. I need to know how to get repository details in this JSON
>> file.
>>
>>
>> Thanks !
>>
>>
>>
>
--
Regards,
Manula Thantriwatte.
Re: Fwd: Error in unmarshalling after removing root element from
input json
Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
Please check
http://cxf.apache.org/docs/jax-rs-data-bindings.html#JAX-RSDataBindings-WrappingandUnwrappingJSONsequences
or try JacksonJsonProvider (non JAXB variant), I think it can unmarshall
the root-less sequence directly into a bean
Cheers, Sergey
On 12/03/14 12:15, Manula Thantriwatte wrote:
> Hi All,
>
> I want to parse the JSON string which haven't root element. When I google I
> found there is a configurations to dropRootElement. This is work for me for
> the output json. But it didn't work for the input json. How can I solve
> this problem. Here I attach my sample JSON file.
>
> {
> "ref": "refs/heads/master",
> "after": "a6abbdeaf4b7b29b646501583d408f16a033a975",
> "before": "244d9eeeb5de42ed078bc469d82a99106de28d87",
> "created": false,
> "deleted": false,
> "forced": false,
> "compare": "https://github.com/manulachathurika/stratos2-test/compare/244d9eeeb5de...a6abbdeaf4b7",
> "commits": [
> {
> "id": "a6abbdeaf4b7b29b646501583d408f16a033a975",
> "distinct": true,
> "message": "Test",
> "timestamp": "2014-03-12T14:04:31+05:30",
> "url": "https://github.com/manulachathurika/stratos2-test/commit/a6abbdeaf4b7b29b646501583d408f16a033a975",
> "author": {
> "name": "Manula Thantriwatte",
> "email": "manula@apache.org",
> "username": "manulachathurika"
> },
> "committer": {
> "name": "Manula Thantriwatte",
> "email": "manula@apache.org",
> "username": "manulachathurika"
> },
> "added": [
>
> ],
> "removed": [
>
> ],
> "modified": [
> "www/sleep.php"
> ]
> }
> ],
> "head_commit": {
> "id": "a6abbdeaf4b7b29b646501583d408f16a033a975",
> "distinct": true,
> "message": "Test",
> "timestamp": "2014-03-12T14:04:31+05:30",
> "url": "https://github.com/manulachathurika/stratos2-test/commit/a6abbdeaf4b7b29b646501583d408f16a033a975",
> "author": {
> "name": "Manula Thantriwatte",
> "email": "manula@apache.org",
> "username": "manulachathurika"
> },
> "committer": {
> "name": "Manula Thantriwatte",
> "email": "manula@apache.org",
> "username": "manulachathurika"
> },
> "added": [
>
> ],
> "removed": [
>
> ],
> "modified": [
> "www/sleep.php"
> ]
> },
> "repository": {
> "id": 17658115,
> "name": "stratos2-test",
> "url": "https://github.com/manulachathurika/stratos2-test",
> "description": "Stratos2 Test",
> "watchers": 0,
> "stargazers": 0,
> "forks": 0,
> "fork": true,
> "size": 112,
> "owner": {
> "name": "manulachathurika",
> "email": "manulachathurika@gmail.com"
> },
> "private": false,
> "open_issues": 0,
> "has_issues": false,
> "has_downloads": true,
> "has_wiki": true,
> "language": "PHP",
> "created_at": 1394607356,
> "pushed_at": 1394613293,
> "master_branch": "master"
> },
> "pusher": {
> "name": "manulachathurika",
> "email": "manulachathurika@gmail.com"
> }}
>
>
> I want to get the repository details. In this JSON there isn't root
> element. I need to know how to get repository details in this JSON
> file.
>
>
> Thanks !
>
>
Fwd: Error in unmarshalling after removing root element from input json
Posted by Manula Thantriwatte <ma...@gmail.com>.
Hi All,
I want to parse the JSON string which haven't root element. When I google I
found there is a configurations to dropRootElement. This is work for me for
the output json. But it didn't work for the input json. How can I solve
this problem. Here I attach my sample JSON file.
{
"ref": "refs/heads/master",
"after": "a6abbdeaf4b7b29b646501583d408f16a033a975",
"before": "244d9eeeb5de42ed078bc469d82a99106de28d87",
"created": false,
"deleted": false,
"forced": false,
"compare": "https://github.com/manulachathurika/stratos2-test/compare/244d9eeeb5de...a6abbdeaf4b7",
"commits": [
{
"id": "a6abbdeaf4b7b29b646501583d408f16a033a975",
"distinct": true,
"message": "Test",
"timestamp": "2014-03-12T14:04:31+05:30",
"url": "https://github.com/manulachathurika/stratos2-test/commit/a6abbdeaf4b7b29b646501583d408f16a033a975",
"author": {
"name": "Manula Thantriwatte",
"email": "manula@apache.org",
"username": "manulachathurika"
},
"committer": {
"name": "Manula Thantriwatte",
"email": "manula@apache.org",
"username": "manulachathurika"
},
"added": [
],
"removed": [
],
"modified": [
"www/sleep.php"
]
}
],
"head_commit": {
"id": "a6abbdeaf4b7b29b646501583d408f16a033a975",
"distinct": true,
"message": "Test",
"timestamp": "2014-03-12T14:04:31+05:30",
"url": "https://github.com/manulachathurika/stratos2-test/commit/a6abbdeaf4b7b29b646501583d408f16a033a975",
"author": {
"name": "Manula Thantriwatte",
"email": "manula@apache.org",
"username": "manulachathurika"
},
"committer": {
"name": "Manula Thantriwatte",
"email": "manula@apache.org",
"username": "manulachathurika"
},
"added": [
],
"removed": [
],
"modified": [
"www/sleep.php"
]
},
"repository": {
"id": 17658115,
"name": "stratos2-test",
"url": "https://github.com/manulachathurika/stratos2-test",
"description": "Stratos2 Test",
"watchers": 0,
"stargazers": 0,
"forks": 0,
"fork": true,
"size": 112,
"owner": {
"name": "manulachathurika",
"email": "manulachathurika@gmail.com"
},
"private": false,
"open_issues": 0,
"has_issues": false,
"has_downloads": true,
"has_wiki": true,
"language": "PHP",
"created_at": 1394607356,
"pushed_at": 1394613293,
"master_branch": "master"
},
"pusher": {
"name": "manulachathurika",
"email": "manulachathurika@gmail.com"
}}
I want to get the repository details. In this JSON there isn't root
element. I need to know how to get repository details in this JSON
file.
Thanks !
--
Regards,
Manula Thantriwatte.