Repeated keys are quite legal in JSON, but many libraries don’t support that.
It does look like that data layout could be redesigned to be more portable. wunder Walter Underwood [email protected] http://observer.wunderwood.org/ (my blog) > On Feb 6, 2020, at 8:38 AM, Doug Turnbull > <[email protected]> wrote: > > Thanks for the tip, > > The issue is json.nl produces non-standard json with duplicate keys. Solr > generates the following, which json lint fails given multiple keys > > { > "positions": { > "position": 155, > "position": 844, > "position": 1726 > } > } > > On Thu, Feb 6, 2020 at 11:36 AM Munendra S N <[email protected]> > wrote: > >>> >>> Notice the lists, within lists, within lists. Where the keys are adjacent >>> items in the list. Is there a reason this isn't a JSON dictionary? >>> >> I think this is because of NamedList. Have you tried using json.nl=map as >> a >> query parameter for this case? >> >> Regards, >> Munendra S N >> >> >> >> On Thu, Feb 6, 2020 at 10:01 PM Doug Turnbull < >> [email protected]> wrote: >> >>> Hi all, >>> >>> I was curious if anyone had any tips on parsing the JSON response of the >>> term vectors component? Or anyway to force it to be more standard JSON? >> It >>> appears to be very heavily nested and idiosyncratic JSON, such as below. >>> >>> Notice the lists, within lists, within lists. Where the keys are adjacent >>> items in the list. Is there a reason this isn't a JSON dictionary? >> Instead >>> you have to build a stateful list parser that just seems prone to >> errors... >>> >>> Any thoughts or ideas are very welcome, I probably just need to do >>> something rather simple here... >>> >>> "termVectors": [ >>> "D100000", [ >>> "uniqueKey", "D100000", >>> "body", [ >>> "1", [ >>> "positions", [ >>> "position", 92, >>> "position", 113 >>> ] >>> ], >>> "10", [ ... >>> >>> -- >>> *Doug Turnbull **| CTO* | OpenSource Connections >>> <http://opensourceconnections.com>, LLC | 240.476.9983 >>> Author: Relevant Search <http://manning.com/turnbull> >>> This e-mail and all contents, including attachments, is considered to be >>> Company Confidential unless explicitly stated otherwise, regardless >>> of whether attachments are marked as such. >>> >> > > > -- > *Doug Turnbull **| CTO* | OpenSource Connections > <http://opensourceconnections.com>, LLC | 240.476.9983 > Author: Relevant Search <http://manning.com/turnbull> > This e-mail and all contents, including attachments, is considered to be > Company Confidential unless explicitly stated otherwise, regardless > of whether attachments are marked as such.
