PROPER MAPPING FOR DYNAMIC FIELDS

Hank Greenberg

Total Post:12

Points:84
Posted by  Hank Greenberg
JSON 
 1369  View(s)
Ratings:
Rate this:
Hi Expert!

I have the following document structure:

{
  "some_field": "some_data",
  "entries": {
    {"id": "some_id", "type": "some_type", "value": "some_value"},
    {"id": "another_id", "type": "another_type", "value": {"foo": 1, "bar": "two"}
  }
}

So I would like to map entries based on the "type" field. Which mapping type or flag should I use? Or maybe I need to change my doc structure?

  1. AVADHESH PATEL

    Post:604

    Points:4228
    Re: Proper Mapping for dynamic fields

    Hi Hank!

    I think you should use array with "'[' ']'" you can check your json using this website

    {
       "some_field":"some_data",
       "entries":[{
             "id":"some_id",
             "type":"some_type",
             "value":"some_value"
          },
          {
             "id":"another_id",
             "type":"another_type",
             "value":{
                "foo":1,
                "bar":"two"
             }
          }]
    }

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!