D8 formatting json export

by deelite   Last Updated January 11, 2018 15:07 PM

I built a REST export view for a content type.

Now I get this output:

[{
    "field_event_id": "12",
    "field_location_name": "good location",
    "field_location_address": "address xy"
}, {
    "field_event_id": "13",
    "field_location_name": "better location",
    "field_location_address": "address yz"
}]

But I need this structure:

[
    {
        "field_event_id":12,
        "metasets":[
            {
                "name":"title",
                "version":"1",
                "object":{
                    "field_location_name" : "good location",
                    "field_location_address": "address xy",
                    ...
                }
            },
        ]
    },
    {
        "field_event_id":13,
        "metasets":[
            {
                "name":"title",
                "version":"1",
                "object":{
                    "field_location_name" : "better location",
                    "field_location_address": "address yz",
                    ...
                }
            },
        ]
    }
]

How can I get this done?

Tags : views rest json


Related Questions


How to remove Drupal 8 JSON Export Backslashes

Updated June 28, 2017 06:07 AM

Parse REST Json replay

Updated June 01, 2016 08:03 AM

REST export doesn't give image URLs

Updated March 20, 2017 17:07 PM

Rest Export JSON format

Updated April 18, 2017 15:07 PM