Skip to content

JSON object properties are not positional #27

@clintongormley

Description

@clintongormley

Hiya

It looks like you are parsing JSON as a stream, where position matters, instead of parsing the whole objects before analysing them. For instance, this works:

curl -XGET 'http://127.0.0.2:9200/_all/_search'  -d '
{ query: 
    {
       "filteredQuery" : {
          "query" : {
             "term" : {
                "text" : "foo"
             }
          },
          "filter" : {
             "range" : {
                "num" : {
                   "from" : 10,
                   "to" : 20
                }
             }
          }
       }
   }
}
'

But this fails:
curl -XGET 'http://127.0.0.2:9200/_all/_search' -d '
{ query:
{
"filteredQuery" : {
"filter" : {
"range" : {
"num" : {
"to" : 20,
"from" : 10
}
}
},
"query" : {
"term" : {
"text" : "foo"
}
}
}
}
}
'

A JSON parser should consider these two structures to be identical, which is also the thing that rules out having non-unique property names.

thanks

Clint

(Edited to correct JSON)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions