Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MINOR Add notes on upgrading for Convert::json2array() changes

  • Loading branch information...
commit c52f75e3194fd309e6ac05ed957e3da8e8f44ab4 1 parent dbc4be3
@halkyon halkyon authored
Showing with 32 additions and 0 deletions.
  1. +32 −0 docs/en/changelogs/3.0.0.md
View
32 docs/en/changelogs/3.0.0.md
@@ -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)`.

0 comments on commit c52f75e

Please sign in to comment.
Something went wrong with that request. Please try again.