Commit 833fd51 1 parent 7c6ec1e commit 833fd51 Copy full SHA for 833fd51
File tree 1 file changed +24
-1
lines changed
1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ The process of using the classes is very simple. What you have to do is the foll
55
55
56
56
For more information and advanced use cases, check [ here] ( https://webfiori.com/learn/webfiori-json ) .
57
57
58
- ## Simple Example
58
+ ### Simple Example
59
59
The following code shows a very simple usage example.
60
60
61
61
``` php
@@ -88,4 +88,27 @@ The output of the code will be like that:
88
88
echo $j;
89
89
```
90
90
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
+ ```
91
114
You can’t perform that action at this time.
0 commit comments