File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree 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
5555
5656For more information and advanced use cases, check [ here] ( https://webfiori.com/learn/webfiori-json ) .
5757
58- ## Simple Example
58+ ### Simple Example
5959The following code shows a very simple usage example.
6060
6161``` php
@@ -88,4 +88,27 @@ The output of the code will be like that:
8888echo $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
You can’t perform that action at this time.
0 commit comments