Skip to content

Commit 833fd51

Browse files
authored
Update README.md
1 parent 7c6ec1e commit 833fd51

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

README.md

+24-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ The process of using the classes is very simple. What you have to do is the foll
5555

5656
For more information and advanced use cases, check [here](https://webfiori.com/learn/webfiori-json).
5757

58-
## Simple Example
58+
### Simple Example
5959
The following code shows a very simple usage example.
6060

6161
```php
@@ -88,4 +88,27 @@ The output of the code will be like that:
8888
echo $j;
8989
```
9090

91+
Following example shows how data can be added directly using the constructure.
92+
93+
``` php
94+
$jsonObj = new Json([
95+
'first-name' => 'Ibrahim',
96+
'last-name' => 'BinAlshikh',
97+
'age' => 26,
98+
'is-married' => true,
99+
'mobile-number' => null
100+
]);
101+
```
102+
103+
The JSON output of this code will be the following:
104+
105+
``` json
106+
{
107+
"first-name":"Ibrahim",
108+
"last-name":"BinAlshikh",
109+
"age":26,
110+
"is-married":true,
111+
"mobile-number":null
112+
}
113+
```
91114

0 commit comments

Comments
 (0)