Plex Media Center for OS X Leopard

5.2.3. JSON — JSON parsing and generation

The JSON module contains functions allowing the developer to easily parse, generate & manipulate data represented as JSON-formatted strings.

TODO: More text

This module defines the following functions:

JSON.ObjectFromString(string)

Returns a Python object created by parsing the given string.

Parameter:string (str) – The JSON-formatted string to parse
Returns:An object created from the given JSON representation
Return type:object
JSON.ObjectFromURL(url, values=None, headers={}, cacheTime=None)

Returns a Python object created by parsing the response of a given HTTP request.

Parameters:
  • url (str) – The URL to request JSON-formatted data from from
  • values (dict) – The values to use if making a POST request
  • headers (dict) – Additional headers to include in the request
  • cacheTime (int) – The maximum number of seconds the response should be cached for
JSON.StringFromObject(obj)

Returns a JSON-formatted string representing a given Python object.

Parameter:obj (object) – The Python object to generate a representation of
Returns:A JSON-formatted string representation of the object
Return type:str

Previous topic

5.2.2. XML — XML markup parsing & generation

Next topic

5.2.4. RSS — RSS feed parsing