You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By default all public properties of the class will be inspected. For all properties that have a json key with the same name the according value will be set.
18
+
By default all public properties of the class will be inspected. For all properties that have a JSON key with the same name the according value will be set.
19
19
20
20
### A simple example
21
21
Assume you have a class `Person` that looks like this:
22
22
```php
23
-
class Person {
23
+
class Person
24
+
{
24
25
public $id;
25
26
public $name;
26
27
}
27
28
```
28
29
29
-
The following code will transform the given json data into an instance of `Person`.
30
+
The following code will transform the given JSON data into an instance of `Person`.
@@ -82,7 +84,7 @@ The `JsonDecoder` class accepts two boolean constructor parameters to enable the
82
84
To do so a so called `PropertyAccessor` will be installed and on property set the proxy will set the property to accessible, set the according value and then will set the property to not accessible again.
83
85
84
86
### Transforming an array of elements
85
-
If your json contains an array of elements at the root level you can use the `decodeMultiple` method to transform the json data into an array of class type objects.
87
+
If your JSON contains an array of elements at the root level you can use the `decodeMultiple` method to transform the JSON data into an array of class type objects.
86
88
87
89
```php
88
90
$jsonDecoder = new JsonDecoder();
@@ -103,7 +105,7 @@ The following `Binding` implementations are available
103
105
*[CallbackBinding](#callbackbinding)
104
106
105
107
#### FieldBinding
106
-
Defines a json field to property binding for the given type.
108
+
Defines a JSON field to property binding for the given type.
107
109
108
110
**Signature:**
109
111
```php
@@ -121,7 +123,7 @@ new ArrayBinding($property, $jsonField, $type);
121
123
This defines a field mapping for the property `$property` to an array of class instance of type `$type` with data in `$jsonField`.
0 commit comments