Skip to content

Commit

Permalink
MINOR Add notes on upgrading for Convert::json2array() changes
Browse files Browse the repository at this point in the history
  • Loading branch information
halkyon committed Mar 31, 2012
1 parent dbc4be3 commit c52f75e
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions docs/en/changelogs/3.0.0.md
Expand Up @@ -113,6 +113,38 @@ As with any SilverStripe upgrade, we recommend database backups before calling `
See [mysql.com](http://dev.mysql.com/doc/refman/5.5/en/converting-tables-to-innodb.html) for details on the conversion.
Note: MySQL has made InnoDB the default engine in its [5.5 release](http://dev.mysql.com/doc/refman/5.5/en/innodb-storage-engine.html).

### Convert::json2array() changes ###

Convert JSON functions have been changed to use built-in json PHP functions `json_decode()` and `json_encode()`

Because `json_decode()` will convert nested JSON structures to arrays as well, this has changed the way it worked,
as before nested structures would be converted to an object instead.

So, given the following JSON input to `Convert::json2array()`:

{"Joe":"Bloggs","Tom":"Jones","My":{"Complicated":"Structure"}}

Here's the output from SilverStripe 2.4, with nested JSON as objects:

array(
'Joe' => 'Bloggs'
'Tom' => 'Jones',
'My' => stdObject(
Complicated => 'Structure' // property on object
)
)

Now in SilverStripe 3.x, nested structures are arrays:

array(
'Joe' => 'Bloggs',
'Tom' => 'Jones',
'My' => array(
'Complicated' => 'Structure' // key value on nested array
)
)


### GridField: Replacement for TableListField and ComplexTableField ###

We have a new component for managing lists of objects: The `[GridField](/topics/grid-field)`.
Expand Down

0 comments on commit c52f75e

Please sign in to comment.