You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by entdeveloper <ca...@gmail.com> on 2011/06/21 04:08:37 UTC

Update JSON Invalid

I'm looking at the wiki article about updating the index with json and the
format doesn't seem well formed to me.
http://wiki.apache.org/solr/UpdateJSON

Technically, yes, it's valid json, but most libraries treat the json objects
as maps, and with multiple "add" elements as the keys, you cannot properly
deserialize.

As an example, try putting this into jsonlint.com, and notice it trims off
one of the docs:
{
 "add": {"doc": {"id" : "TestDoc1", "title" : "test1"} },
 "add": {"doc": {"id" : "TestDoc2", "title" : "another test"} }
}

Is there something I'm just not seeing? Should we consider cleaning up this
format, possibly using some json arrays so that it makes more sense from a
json perspective?

--
View this message in context: http://lucene.472066.n3.nabble.com/Update-JSON-Invalid-tp3088963p3088963.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Update JSON Invalid

Posted by Yonik Seeley <yo...@lucidimagination.com>.
On Mon, Jun 20, 2011 at 11:25 PM, Shawn Heisey <el...@elyograg.org> wrote:
> On 6/20/2011 8:08 PM, entdeveloper wrote:
>>
>> Technically, yes, it's valid json, but most libraries treat the json
>> objects
>> as maps, and with multiple "add" elements as the keys, you cannot properly
>> deserialize.
>>
>> As an example, try putting this into jsonlint.com, and notice it trims off
>> one of the docs:
>> {
>>  "add": {"doc": {"id" : "TestDoc1", "title" : "test1"} },
>>  "add": {"doc": {"id" : "TestDoc2", "title" : "another test"} }
>> }
>>
>> Is there something I'm just not seeing? Should we consider cleaning up
>> this
>> format, possibly using some json arrays so that it makes more sense from a
>> json perspective?
>
> This was brought up recently and should now be fixed in Solr 3.2.
>
> https://issues.apache.org/jira/browse/SOLR-2496

Thanks for the reminder, we obviously need to update the docs!

-Yonik

Re: Update JSON Invalid

Posted by Shawn Heisey <el...@elyograg.org>.
On 6/20/2011 8:08 PM, entdeveloper wrote:
> Technically, yes, it's valid json, but most libraries treat the json objects
> as maps, and with multiple "add" elements as the keys, you cannot properly
> deserialize.
>
> As an example, try putting this into jsonlint.com, and notice it trims off
> one of the docs:
> {
>   "add": {"doc": {"id" : "TestDoc1", "title" : "test1"} },
>   "add": {"doc": {"id" : "TestDoc2", "title" : "another test"} }
> }
>
> Is there something I'm just not seeing? Should we consider cleaning up this
> format, possibly using some json arrays so that it makes more sense from a
> json perspective?

This was brought up recently and should now be fixed in Solr 3.2.

https://issues.apache.org/jira/browse/SOLR-2496

Shawn