Version: current

# Class JSONDataFormatter

  Object
  DataFormatter
  JSONDataFormatter

Package: sapphire\formatters
Located at sapphire/api/JSONDataFormatter.php

## Methods summary

`public` | # `supportedExtensions( )` Return an array of the extensions that this data formatter supports Return an array of the extensions that this data formatter supports
`public` | # `supportedMimeTypes( )`
`public String` | # `convertDataObject( `DataObjectInterface` $obj, mixed $fields = null, mixed $relations = null )` Generate an XML representation of the given `DataObject`. Generate an XML representation of the given `DataObject`. #### Parameters $obj DataObject $obj $fields $includeHeader Include <?xml ...?> header (Default: true) $relations #### Returns `String` XML
`public String` | # `convertDataObjectSet( `DataObjectSet` $set, mixed $fields = null )` Generate an XML representation of the given `DataObjectSet`. Generate an XML representation of the given `DataObjectSet`. #### Parameters $set DataObjectSet $set $fields #### Returns `String` XML
`public` | # `convertStringToArray( string $strData )` #### Parameters $strData string $strData HTTP Payload as string #### Overrides `DataFormatter::convertStringToArray`

### Methods inherited from DataFormatter

`for_extension()`, `for_extensions()`, `for_mimetype()`, `for_mimetypes()`, `getCustomAddFields()`, `getCustomFields()`, `getCustomRelations()`, `getFieldsForObj()`, `getOutputContentType()`, `getRemoveFields()`, `getTotalSize()`, `setCustomAddFields()`, `setCustomFields()`, `setCustomRelations()`, `setRemoveFields()`, `setTotalSize()`

### Methods inherited from Object

`__call()`, `__construct()`, `__toString()`, `__wakeup()`, `addMethodsFrom()`, `addStaticVars()`, `addWrapperMethod()`, `add_extension()`, `add_static_var()`, `allMethodNames()`, `cacheToFile()`, `cacheToFileWithArgs()`, `clearCache()`, `combined_static()`, `create()`, `createMethod()`, `create_from_string()`, `defineMethods()`, `exists()`, `extInstance()`, `extend()`, `getCustomClass()`, `getExtensionInstance()`, `getExtensionInstances()`, `get_extensions()`, `get_static()`, `hasExtension()`, `hasMethod()`, `has_extension()`, `invokeWithExtensions()`, `is_a()`, `loadCache()`, `parentClass()`, `parse_class_spec()`, `remove_extension()`, `sanitiseCachename()`, `saveCache()`, `set_stat()`, `set_static()`, `set_uninherited()`, `stat()`, `strong_create()`, `uninherited()`, `uninherited_static()`, `useCustomClass()`

### Magic methods summary

## Properties summary

`public static string` | $api_base | #
`protected string` | $outputContentType | # Specifies the mimetype in which all strings returned from the convert*() methods should be used, e.g. "text/xml". Specifies the mimetype in which all strings returned from the convert*() methods should be used, e.g. "text/xml".

### Properties inherited from DataFormatter

`$customAddFields`, `$customFields`, `$customRelations`, `$priority`, `$relationDepth`, `$removeFields`, `$totalSize`

### Properties inherited from Object

`$class`, `$extension_instances`, `$extensions`

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -