JSON Output - AFS

AFS Integration Guide

Product
AFS
AFS_Version
7.7
Category
Reference Guide

JSON (JavaScript Object Notation) is a lightweight text-based open standard derived from the JavaScript programming language. It is used to represent simple data structures and associative arrays, called objects.

For more information about the complete language specification, see http://www.json.org/.

The JSON output feed is closely related to the XML one. The name, purpose, and content of all the nodes remains the same. It can be considered as a simple translation from XML to JSON.

Four general rules drive this translation:

  • XML nodes are treated as JSON objects.
  • XML attributes are treated as JSON object properties.
  • Unique XML child nodes are treated as nested JSON objects.
  • Lists of XML child nodes are treated as a single JSON object with a list property.

Example

An output feed may be represented in XML as follows:

<afs:header>
<afs:query userId="f58b1d87-cb41-46c1-9efb-d8f47b10f8c8"
sessionId="f9f0da83-016d-4546-9a17-4fd66092571a"
textQuery=""
date="2010-11-25T15:06:14+0100">
<afs:queryParam name="afs:output" value="xml"/>
<afs:queryParam name="afs:service" value="7019"/>
</afs:query>
...
</afs:replies>

The same output feed sample becomes the following in JSON:

{"header":
{"query":
{"userId" : "f58b1d87-cb41-46c1-9efb-d8f47b10f8c8",
"sessionId" : "f9f0da83-016d-4546-9a17-4fd66092571a",
"textQuery" : "",
"date":"2010-11-25T14:57:21+0100",
"queryParam" :
[{"name":"afs:output","value":"json"},
{"name":"afs:service","value":"7019"}
]
}
},
...
}

The complete JSON output feed is described in a JSON Schema at http://ref.antidot.net/v7/search.json-schema.
The schema complies with the standard described at http://json-schema.org/.