wingy
wingy

Reputation: 559

JSON data with array structure

I am using Neo4j and ExtJS in my application.

One good thing is that both handle JSON with array structure.

Neo4j returns and ExtJS can consume JSON like this:

{
  columns: ["name", "age"],
  data: [
    ["Peter", 34],
    ["Mike", 52]
  ]
}

instead of:

[
  {"name": "Peter", "age" 34},
  {"name": "Mike", "age" 52},
]

However, from my application server's HTTP API I want people to be able to choose which one of these JSON structures to receive.

So they are both JSON which means the HTTP header should be "Accept": "application/json". But how should I allow them to pick either one of the structures? Should they set a header or a query param? What is best practice?

Upvotes: 0

Views: 169

Answers (1)

Aurelio De Rosa
Aurelio De Rosa

Reputation: 22162

I think that a simple param in the request would be enough.

Upvotes: 1

Related Questions