I'm using views Datasource to output a JSONP file, i want to know if there's any way to group some fields into a parent??

something like that:

<Image>
     <SizeName>Small</SizeName>
     <Width>32</Width>
     <Height>40</Height>
     <Url></Url>
</Image>

Appreciate your help,

Comments

dawehner’s picture

Project: Views (for Drupal 7) » Views Datasource
Version: 6.x-2.16 » 6.x-1.x-dev

This seems to be a support questions for views datasource.

anthonylindsay’s picture

Issue summary: View changes
Status: Active » Closed (works as designed)

Yes: in D7, image properties are grouped within an image element by default.

e.g.

[
  {
    "NID" : {
      "link" : null,
      "title" : "<a href=\"http://node/3\">普派 chinese</a>",
      "Custom text" : "<a href=\"\"><a href=\"http://node/3\">普派 chinese</a></a>",
      "Image" : null
    }
  },
  {
    "NID" : {
      "link" : "http://www.google.com",
      "title" : "<a href=\"http://node/2\">some content</a>",
      "Custom text" : "<a href=\"http://www.google.com\"><a href=\"http://node/2\">some content</a></a>",
      "Image" : {
        "src" : "https://r1oa7.ply.st/sites/default/files/field/image/audio_icon.png",
        "alt" : ""
      }
    }
  },
  {
    "NID" : {
      "link" : "http://annertech.com",
      "title" : "<a href=\"http://node/1\">title 2 thing</a>",
      "Custom text" : "<a href=\"http://annertech.com\"><a href=\"http://node/1\">title 2 thing</a></a>",
      "Image" : null
    }
  }
]