summaryrefslogtreecommitdiff
path: root/addons/azure_iot/docs/azure_rtos_iot_json.md
blob: 6faca527c1414d80a96a3e7c4ac8a14b99fcbdc7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
# Azure IoT JSON

## Azure IoT JSON Reader

**nx_azure_iot_json_reader_with_buffer_init**
***
<div style="text-align: right">Initializes JSON Reader</div>

**Prototype**
```c
UINT nx_azure_iot_json_reader_with_buffer_init(NX_AZURE_IOT_JSON_READER *reader_ptr,
                                               const UCHAR *buffer_ptr, UINT buffer_len);
```
**Description**

<p>Initializes an #NX_AZURE_IOT_JSON_READER to read the JSON payload contained within the provided 
buffer. </p>

**Parameters**
| Name | Description |
| - |:-|
| reader_ptr [out]    | A pointer to an #NX_AZURE_IOT_JSON_READER instance to initialize. |
| buffer_ptr [in]     | An pointer to buffer containing the JSON text to read. |
| buffer_len [in]     | Length of buffer.     |

**Return Values**
* NX_AZURE_IOT_SUCCESS Successfully initialized JSON reader.

**Allowed From**

Initialization, Threads

**Example**

**See Also**

<div style="page-break-after: always;"></div>

**nx_azure_iot_json_reader_init**
***
<div style="text-align: right">Initializes JSON Reader</div>

**Prototype**
```c
UINT nx_azure_iot_json_reader_init(NX_AZURE_IOT_JSON_READER *reader_ptr,
                                   NX_PACKET *packet_ptr);
```
**Description**

<p>Initializes an #NX_AZURE_IOT_JSON_READER to read the JSON payload contained within #NX_PACKET</p>

**Parameters**

| Name | Description |
| - |:-|
| reader_ptr [out]    | A pointer to an #NX_AZURE_IOT_JSON_READER instance to initialize. |
| packet_ptr [in]     | A pointer to #NX_PACKET containing the JSON text. |

**Return Values**
* NX_AZURE_IOT_SUCCESS Successfully initialized JSON reader.

**Allowed From**

Threads

**Example**

**See Also**

<div style="page-break-after: always;"></div>

**nx_azure_iot_json_reader_deinit**
***
<div style="text-align: right">De-initializes JSON Reader</div>

**Prototype**
```c
UINT nx_azure_iot_json_reader_deinit(NX_AZURE_IOT_JSON_READER *reader_ptr);

```
**Description**

<p>De-initializes an #NX_AZURE_IOT_JSON_READER</p>

**Parameters**

| Name | Description |
| - |:-|
| reader_ptr [in]    | A pointer to an #NX_AZURE_IOT_JSON_READER instance to de-initialize |

**Return Values**
* NX_AZURE_IOT_SUCCESS Successfully de-initialized JSON reader.

**Allowed From**

Threads

**Example**

**See Also**

<div style="page-break-after: always;"></div>

**nx_azure_iot_json_reader_next_token**
***
<div style="text-align: right">Move to next JSON token</div>

**Prototype**
```c
UINT nx_azure_iot_json_reader_next_token(NX_AZURE_IOT_JSON_READER *reader_ptr);

```
**Description**

<p>Reads the next token in the JSON text and updates the reader state.</p>

**Parameters**

| Name | Description |
| - |:-|
| reader_ptr [in]    | A pointer to an #NX_AZURE_IOT_JSON_READER instance containing the JSON to read. |

**Return Values**
* NX_AZURE_IOT_SUCCESS The token was read successfully.

**Allowed From**

Threads

**Example**

**See Also**

<div style="page-break-after: always;"></div>

**nx_azure_iot_json_reader_skip_children**
***
<div style="text-align: right">Reads and skips over any nested JSON elements</div>

**Prototype**
```c
UINT nx_azure_iot_json_reader_skip_children(NX_AZURE_IOT_JSON_READER *reader_ptr);

```
**Description**

<p>Reads and skips over any nested JSON elements.</p>

**Parameters**

| Name | Description |
| - |:-|
| reader_ptr [in]    | A pointer to an #NX_AZURE_IOT_JSON_READER instance containing the JSON to read. |

**Return Values**
* NX_AZURE_IOT_SUCCESS The children of the current JSON token are skipped successfully.

**Allowed From**

Threads

**Example**

**See Also**

<div style="page-break-after: always;"></div>

**nx_azure_iot_json_reader_token_bool_get**
***
<div style="text-align: right">Gets the JSON token's boolean value</div>

**Prototype**
```c
UINT nx_azure_iot_json_reader_token_bool_get(NX_AZURE_IOT_JSON_READER *reader_ptr,
                                             UINT *value_ptr);

```
**Description**

<p>Gets the JSON token's boolean value.</p>

**Parameters**

| Name | Description |
| - |:-|
| reader_ptr [in]    | A pointer to an #NX_AZURE_IOT_JSON_READER instance containing the JSON to read. |
| value_ptr [out]    | A pointer to a variable to receive the value. |

**Return Values**
* NX_AZURE_IOT_SUCCESS The boolean value is returned.

**Allowed From**

Threads

**Example**

**See Also**

<div style="page-break-after: always;"></div>

**nx_azure_iot_json_reader_token_uint32_get**
***
<div style="text-align: right">Gets the JSON token's number as a 32-bit unsigned integer</div>

**Prototype**
```c
UINT nx_azure_iot_json_reader_token_uint32_get(NX_AZURE_IOT_JSON_READER *reader_ptr,
                                               uint32_t *value_ptr);

```
**Description**

<p>Gets the JSON token's number as a 32-bit unsigned integer.</p>

**Parameters**

| Name | Description |
| - |:-|
| reader_ptr [in]    | A pointer to an #NX_AZURE_IOT_JSON_READER instance containing the JSON to read. |
| value_ptr [out]    | A pointer to a variable to receive the value. |

**Return Values**
* NX_AZURE_IOT_SUCCESS The number is returned.

**Allowed From**

Threads

**Example**

**See Also**

<div style="page-break-after: always;"></div>

**nx_azure_iot_json_reader_token_int32_get**
***
<div style="text-align: right">Gets the JSON token's number as a 32-bit signed integer</div>

**Prototype**
```c
UINT nx_azure_iot_json_reader_token_int32_get(NX_AZURE_IOT_JSON_READER *reader_ptr,
                                              int32_t *value_ptr);

```
**Description**

<p>Gets the JSON token's number as a 32-bit signed integer.</p>

**Parameters**

| Name | Description |
| - |:-|
| reader_ptr [in]    | A pointer to an #NX_AZURE_IOT_JSON_READER instance containing the JSON to read. |
| value_ptr [out]    | A pointer to a variable to receive the value. |

**Return Values**
* NX_AZURE_IOT_SUCCESS The number is returned.

**Allowed From**

Threads

**Example**

**See Also**

<div style="page-break-after: always;"></div>

**nx_azure_iot_json_reader_token_double_get**
***
<div style="text-align: right">Gets the JSON token's number as a `double`</div>

**Prototype**
```c
UINT nx_azure_iot_json_reader_token_double_get(NX_AZURE_IOT_JSON_READER *reader_ptr,
                                               double *value_ptr);

```
**Description**

<p>Gets the JSON token's number as a `double`.</p>

**Parameters**

| Name | Description |
| - |:-|
| reader_ptr [in]    | A pointer to an #NX_AZURE_IOT_JSON_READER instance containing the JSON to read. |
| value_ptr [out]    | A pointer to a variable to receive the value. |

**Return Values**
* NX_AZURE_IOT_SUCCESS The number is returned.

**Allowed From**

Threads

**Example**

**See Also**

<div style="page-break-after: always;"></div>

**nx_azure_iot_json_reader_token_string_get**
***
<div style="text-align: right">Gets the JSON token's string</div>

**Prototype**
```c
UINT nx_azure_iot_json_reader_token_string_get(NX_AZURE_IOT_JSON_READER *reader_ptr,
                                               UCHAR *buffer_ptr, UINT buffer_size, UINT *bytes_copied);

```
**Description**

<p>Gets the JSON token's string after unescaping it, if required.</p>

**Parameters**

| Name | Description |
| - |:-|
| reader_ptr [in]    | A pointer to an #NX_AZURE_IOT_JSON_READER instance containing the JSON to read. |
| buffer_ptr [out]   | A pointer to a buffer where the string should be copied into. |
| buffer_size [in]   | The maximum available space within the buffer referred to by buffer_ptr. |
| bytes_copied [out] | Contains the number of bytes written to the destination which denote the length of the unescaped string. |

**Return Values**
* NX_AZURE_IOT_SUCCESS The string is returned.

**Allowed From**

Threads

**Example**

**See Also**

<div style="page-break-after: always;"></div>

**nx_azure_iot_json_reader_token_is_text_equal**
***
<div style="text-align: right">Compare token to text</div>

**Prototype**
```c
UINT nx_azure_iot_json_reader_token_is_text_equal(NX_AZURE_IOT_JSON_READER *reader_ptr,
                                                  UCHAR *expected_text_ptr, UINT expected_text_len);

```
**Description**

<p>Determines whether the unescaped JSON token value that the #NX_AZURE_IOT_JSON_READER points to is equal to the expected text within the provided buffer bytes by doing a case-sensitive comparison.</p>

**Parameters**

| Name | Description |
| - |:-|
| reader_ptr [in]          | A pointer to an #NX_AZURE_IOT_JSON_READER instance containing the JSON to read. |
| expected_text_ptr [in]   | A pointer to lookup text to compare the token against. |
| expected_text_len [in]   | Length of expected_text_ptr. |

**Return Values**
* NX_TRUE If the current JSON token value in the JSON source semantically matches the expected lookup text.
* NX_FALSE Otherwise.

**Allowed From**

Threads

**Example**

**See Also**

<div style="page-break-after: always;"></div>

**nx_azure_iot_json_reader_token_type**
***
<div style="text-align: right">Determines type of token currently #NX_AZURE_IOT_JSON_READER points to</div>

**Prototype**
```c
UINT nx_azure_iot_json_reader_token_type(NX_AZURE_IOT_JSON_READER *reader_ptr);

```
**Description**

<p>Determines type of token currently #NX_AZURE_IOT_JSON_READER points to..</p>

**Parameters**

| Name | Description |
| - |:-|
| reader_ptr [in]    | A pointer to an #NX_AZURE_IOT_JSON_READER instance containing the JSON to read. |

**Return Values**
* NX_AZURE_IOT_READER_TOKEN_NONE There is no value.
* NX_AZURE_IOT_READER_TOKEN_BEGIN_OBJECT The token kind is the start of a JSON object.     
* NX_AZURE_IOT_READER_TOKEN_END_OBJECT The token kind is the end of a JSON object.     
* NX_AZURE_IOT_READER_TOKEN_BEGIN_ARRAY The token kind is the start of a JSON array.  
* NX_AZURE_IOT_READER_TOKEN_END_ARRAY The token kind is the end of a JSON array.        
* NX_AZURE_IOT_READER_TOKEN_PROPERTY_NAME The token kind is a JSON property name.    
* NX_AZURE_IOT_READER_TOKEN_STRING The token kind is a JSON string.           
* NX_AZURE_IOT_READER_TOKEN_NUMBER The token kind is a JSON number.           
* NX_AZURE_IOT_READER_TOKEN_TRUE The token kind is the JSON literal `true`.             
* NX_AZURE_IOT_READER_TOKEN_FALSE The token kind is the JSON literal `false`.            
* NX_AZURE_IOT_READER_TOKEN_NULL The token kind is the JSON literal `null`.              

**Allowed From**

Threads

**Example**

**See Also**

<div style="page-break-after: always;"></div>

## Azure IoT JSON Writer

**nx_azure_iot_json_writer_init**
***
<div style="text-align: right">Initializes an JSON writer</div>

**Prototype**
```c
UINT nx_azure_iot_json_writer_init(NX_AZURE_IOT_JSON_WRITER *json_writer_ptr,
                                   NX_PACKET *packet_ptr, UINT wait_option);
```
**Description**

<p>Initializes an #NX_AZURE_IOT_JSON_WRITER which writes JSON text into a NX_PACKET.</p>

**Parameters**
| Name | Description |
| - |:-|
| json_writer_ptr [out]  | A pointer to an #NX_AZURE_IOT_JSON_WRITER the instance to initialize. |
| packet_ptr [in]        | A pointer to #NX_PACKET. |
| wait_option [in]       | Ticks to wait for allocating next packet     |

**Return Values**
* NX_AZURE_IOT_SUCCESS Successfully initialized JSON writer.

**Allowed From**

Initialization, Threads

**Example**

**See Also**

<div style="page-break-after: always;"></div>

**nx_azure_iot_json_writer_with_buffer_init**
***
<div style="text-align: right">Initializes an JSON writer</div>

**Prototype**
```c
UINT nx_azure_iot_json_writer_with_buffer_init(NX_AZURE_IOT_JSON_WRITER *json_writer_ptr,
                                               UCHAR *buffer_ptr, UINT buffer_len);
```
**Description**

<p>Initializes an #NX_AZURE_IOT_JSON_WRITER which writes JSON text into a buffer passed.</p>

**Parameters**
| Name | Description |
| - |:-|
| json_writer_ptr [out]  | A pointer to an #NX_AZURE_IOT_JSON_WRITER the instance to initialize. |
| buffer_ptr [in]        | A buffer pointer to which JSON text will be written. |
| buffer_len [in]        | Length of buffer.    |

**Return Values**
* NX_AZURE_IOT_SUCCESS Successfully initialized JSON writer.

**Allowed From**

Initialization, Threads

**Example**

**See Also**

<div style="page-break-after: always;"></div>

**nx_azure_iot_json_writer_deinit**
***
<div style="text-align: right">De-initializes an JSON writer</div>

**Prototype**
```c
UINT nx_azure_iot_json_writer_deinit(NX_AZURE_IOT_JSON_WRITER *json_writer_ptr);
```
**Description**

<p>Deinitializes an #NX_AZURE_IOT_JSON_WRITER.</p>

**Parameters**
| Name | Description |
| - |:-|
| json_writer_ptr [in]  | A pointer to an #NX_AZURE_IOT_JSON_WRITER the instance to de-initialize. |

**Return Values**
* NX_AZURE_IOT_SUCCESS Successfully de-initialized JSON writer.

**Allowed From**

Initialization, Threads

**Example**

**See Also**

<div style="page-break-after: always;"></div>

**nx_azure_iot_json_writer_append_property_with_int32_value**
***
<div style="text-align: right">Appends the UTF-8 property name and value where value is int32</div>

**Prototype**
```c
UINT nx_azure_iot_json_writer_append_property_with_int32_value(NX_AZURE_IOT_JSON_WRITER *json_writer_ptr,
                                                               const UCHAR *property_name, UINT property_name_len,
                                                               int32_t value);
```
**Description**

<p>Appends the UTF-8 property name and value where value is int32.</p>

**Parameters**
| Name | Description |
| - |:-|
| json_writer_ptr [in]  | A pointer to an #NX_AZURE_IOT_JSON_WRITER. |
| property_name [in]  | The UTF-8 encoded property name of the JSON value to be written. The name is escaped before writing |
| property_name_len [in]  | Length of property_name. |
| value [in]  | The value to be written as a JSON number. |

**Return Values**
* NX_AZURE_IOT_SUCCESS The property name and int32 value was appended successfully.

**Allowed From**

Initialization, Threads

**Example**

**See Also**

<div style="page-break-after: always;"></div>

**nx_azure_iot_json_writer_append_property_with_double_value**
***
<div style="text-align: right">Appends the UTF-8 property name and value where value is double</div>

**Prototype**
```c
UINT nx_azure_iot_json_writer_append_property_with_double_value(NX_AZURE_IOT_JSON_WRITER *json_writer_ptr,
                                                                const UCHAR *property_name, UINT property_name_len,
                                                                double value, UINT fractional_digits);
```
**Description**

<p>Appends the UTF-8 property name and value where value is double.</p>

**Parameters**
| Name | Description |
| - |:-|
| json_writer_ptr [in]  | A pointer to an #NX_AZURE_IOT_JSON_WRITER. |
| property_name [in]  | The UTF-8 encoded property name of the JSON value to be written. The name is escaped before writing |
| property_name_len [in]  | Length of property_name. |
| value [in]  | The value to be written as a JSON number. |
| fractional_digits [in]  | The number of digits of the value to write after the decimal point and truncate the rest. |

**Return Values**
* NX_AZURE_IOT_SUCCESS The property name and double value was appended successfully.

**Allowed From**

Initialization, Threads

**Example**

**See Also**

<div style="page-break-after: always;"></div>

**nx_azure_iot_json_writer_append_property_with_bool_value**
***
<div style="text-align: right">Appends the UTF-8 property name and value where value is boolean</div>

**Prototype**
```c
UINT nx_azure_iot_json_writer_append_property_with_bool_value(NX_AZURE_IOT_JSON_WRITER *json_writer_ptr,
                                                              const UCHAR *property_name, UINT property_name_len,
                                                              UINT value);
```
**Description**

<p>Appends the UTF-8 property name and value where value is boolean.</p>

**Parameters**
| Name | Description |
| - |:-|
| json_writer_ptr [in]  | A pointer to an #NX_AZURE_IOT_JSON_WRITER. |
| property_name [in]  | The UTF-8 encoded property name of the JSON value to be written. The name is escaped before writing |
| property_name_len [in]  | Length of property_name. |
| value [in]  | The value to be written as a JSON literal `true` or `false`. |

**Return Values**
* NX_AZURE_IOT_SUCCESS The property name and bool value was appended successfully.

**Allowed From**

Initialization, Threads

**Example**

**See Also**

<div style="page-break-after: always;"></div>

**nx_azure_iot_json_writer_append_property_with_string_value**
***
<div style="text-align: right">Appends the UTF-8 property name and value where value is string</div>

**Prototype**
```c
UINT nx_azure_iot_json_writer_append_property_with_string_value(NX_AZURE_IOT_JSON_WRITER *json_writer_ptr,
                                                                const UCHAR *property_name, UINT property_name_len,
                                                                const UCHAR *value, UINT value_len);
```
**Description**

<p>Appends the UTF-8 property name and value where value is string.</p>

**Parameters**
| Name | Description |
| - |:-|
| json_writer_ptr [in]  | A pointer to an #NX_AZURE_IOT_JSON_WRITER. |
| property_name [in] | The UTF-8 encoded property name of the JSON value to be written. The name is escaped before writing |
| property_name_len [in]  | Length of property_name. |
| value [in]  |  The UTF-8 encoded property name of the JSON value to be written. The name is escaped before writing. |
| value_len [in]  |  Length of value. |
 
**Return Values**
* NX_AZURE_IOT_SUCCESS The property name and string value was appended successfully.

**Allowed From**

Initialization, Threads

**Example**

**See Also**

<div style="page-break-after: always;"></div>

**nx_azure_iot_json_writer_get_bytes_used**
***
<div style="text-align: right">Returns the length containing the JSON text written to the underlying buffer</div>

**Prototype**
```c
UINT nx_azure_iot_json_writer_get_bytes_used(NX_AZURE_IOT_JSON_WRITER *json_writer_ptr);
```
**Description**

<p>Returns the length containing the JSON text written to the underlying buffer.</p>

**Parameters**
| Name | Description |
| - |:-|
| json_writer_ptr [in]  | A pointer to an #NX_AZURE_IOT_JSON_WRITER. |
 
**Return Values**
* UINT Value containing the length of JSON text built so far.

**Allowed From**

Initialization, Threads

**Example**

**See Also**

<div style="page-break-after: always;"></div>

**nx_azure_iot_json_writer_append_string**
***
<div style="text-align: right">Appends the UTF-8 text value (as a JSON string) into the buffer</div>

**Prototype**
```c
UINT nx_azure_iot_json_writer_append_string(NX_AZURE_IOT_JSON_WRITER *json_writer_ptr,
                                            const UCHAR *value, UINT value_len);
```
**Description**

<p>Appends the UTF-8 text value (as a JSON string) into the buffer.</p>

**Parameters**
| Name | Description |
| - |:-|
| json_writer_ptr [in]  | A pointer to an #NX_AZURE_IOT_JSON_WRITER. |
| value [in]  | Pointer of UCHAR buffer that contains UTF-8 encoded value to be written as a JSON string The value is escaped before writing. |
| value_len [in]  | Length of value. |

**Return Values**
* NX_AZURE_IOT_SUCCESS The string value was appended successfully.

**Allowed From**

Initialization, Threads

**Example**

**See Also**

<div style="page-break-after: always;"></div>

**nx_azure_iot_json_writer_append_json_text**
***
<div style="text-align: right">Appends an existing UTF-8 encoded JSON text into the buffer</div>

**Prototype**
```c
UINT nx_azure_iot_json_writer_append_json_text(NX_AZURE_IOT_JSON_WRITER *json_writer_ptr,
                                               const UCHAR *json, UINT json_len);
```
**Description**

<p>Appends an existing UTF-8 encoded JSON text into the buffer, useful for appending nested JSON.</p>

**Parameters**
| Name | Description |
| - |:-|
| json_writer_ptr [in]  | A pointer to an #NX_AZURE_IOT_JSON_WRITER. |
| json [in]  | A pointer to single, possibly nested, valid, UTF-8 encoded, JSON value to be written as is, without any formatting or spacing changes. No modifications are made to this text, including  escaping. |
| json_len [in]  | Length of json. |


**Return Values**
* NX_AZURE_IOT_SUCCESS The provided json_text was appended successfully.

**Allowed From**

Initialization, Threads

**Example**

**See Also**

<div style="page-break-after: always;"></div>

**nx_azure_iot_json_writer_append_property_name**
***
<div style="text-align: right">Appends property name</div>

**Prototype**
```c
UINT nx_azure_iot_json_writer_append_property_name(NX_AZURE_IOT_JSON_WRITER *json_writer_ptr,
                                                   const UCHAR *value, UINT value_len);
```
**Description**

<p>Appends the UTF-8 property name (as a JSON string) which is the first part of a name/value pair of a JSON object.</p>

**Parameters**
| Name | Description |
| - |:-|
| json_writer_ptr [in]  | A pointer to an #NX_AZURE_IOT_JSON_WRITER. |
| value [in]  | The UTF-8 encoded property name of the JSON value to be written. The name is escaped before writing. |
| value_len [in]  | Length of property name. |

**Return Values**
* NX_AZURE_IOT_SUCCESS The property name was appended successfully.

**Allowed From**

Initialization, Threads

**Example**

**See Also**

<div style="page-break-after: always;"></div>

**nx_azure_iot_json_writer_append_bool**
***
<div style="text-align: right">Appends a boolean value</div>

**Prototype**
```c
UINT nx_azure_iot_json_writer_append_bool(NX_AZURE_IOT_JSON_WRITER *json_writer_ptr, UINT value);
```
**Description**

<p>Appends a boolean value (as a JSON literal `true` or `false`).</p>

**Parameters**
| Name | Description |
| - |:-|
| json_writer_ptr [in]  | A pointer to an #NX_AZURE_IOT_JSON_WRITER. |
| value [in]  | The value to be written as a JSON literal `true` or `false`. |

**Return Values**
* NX_AZURE_IOT_SUCCESS The bool was appended successfully.

**Allowed From**

Initialization, Threads

**Example**

**See Also**

<div style="page-break-after: always;"></div>

**nx_azure_iot_json_writer_append_int32**
***
<div style="text-align: right">Appends a number value.</div>

**Prototype**
```c
UINT nx_azure_iot_json_writer_append_int32(NX_AZURE_IOT_JSON_WRITER *json_writer_ptr, int32_t value);
```
**Description**

<p>Appends an `int32_t` number value.</p>

**Parameters**
| Name | Description |
| - |:-|
| json_writer_ptr [in]  | A pointer to an #NX_AZURE_IOT_JSON_WRITER. |
| value [in]  | The value to be written as a JSON number. |

**Return Values**
* NX_AZURE_IOT_SUCCESS The number was appended successfully.

**Allowed From**

Initialization, Threads

**Example**

**See Also**

<div style="page-break-after: always;"></div>

**nx_azure_iot_json_writer_append_double**
***
<div style="text-align: right">Appends a number value.</div>

**Prototype**
```c
UINT nx_azure_iot_json_writer_append_double(NX_AZURE_IOT_JSON_WRITER *json_writer_ptr,
                                            double value, int32_t fractional_digits);
```
**Description**

<p>Appends a `double` number value.</p>

**Parameters**
| Name | Description |
| - |:-|
| json_writer_ptr [in]  | A pointer to an #NX_AZURE_IOT_JSON_WRITER. |
| value [in]  | The value to be written as a JSON number. |
| fractional_digits [in]  | The number of digits of the value to write after the decimal point and truncate the rest. |

**Return Values**
* NX_AZURE_IOT_SUCCESS The number was appended successfully.

**Allowed From**

Initialization, Threads

**Example**

**See Also**

<div style="page-break-after: always;"></div>

**nx_azure_iot_json_writer_append_null**
***
<div style="text-align: right">Appends the JSON literal `null`</div>

**Prototype**
```c
UINT nx_azure_iot_json_writer_append_null(NX_AZURE_IOT_JSON_WRITER *json_writer_ptr);
```
**Description**

<p>Appends the JSON literal `null`.</p>

**Parameters**
| Name | Description |
| - |:-|
| json_writer_ptr [in]  | A pointer to an #NX_AZURE_IOT_JSON_WRITER. |

**Return Values**
* NX_AZURE_IOT_SUCCESS `null` was appended successfully.

**Allowed From**

Initialization, Threads

**Example**

**See Also**

<div style="page-break-after: always;"></div>

**nx_azure_iot_json_writer_append_begin_object**
***
<div style="text-align: right">Appends the beginning of a JSON object</div>

**Prototype**
```c
UINT nx_azure_iot_json_writer_append_begin_object(NX_AZURE_IOT_JSON_WRITER *json_writer_ptr);
```
**Description**

<p>Appends the beginning of a JSON object (i.e. `{`).</p>

**Parameters**
| Name | Description |
| - |:-|
| json_writer_ptr [in]  | A pointer to an #NX_AZURE_IOT_JSON_WRITER. |

**Return Values**
* NX_AZURE_IOT_SUCCESS Object start was appended successfully.

**Allowed From**

Initialization, Threads

**Example**

**See Also**

<div style="page-break-after: always;"></div>

**nx_azure_iot_json_writer_append_begin_array**
***
<div style="text-align: right">Appends the beginning of a JSON array</div>

**Prototype**
```c
UINT nx_azure_iot_json_writer_append_begin_array(NX_AZURE_IOT_JSON_WRITER *json_writer_ptr);
```
**Description**

<p>Appends the beginning of a JSON array (i.e. `[`).</p>

**Parameters**
| Name | Description |
| - |:-|
| json_writer_ptr [in]  | A pointer to an #NX_AZURE_IOT_JSON_WRITER. |

**Return Values**
* NX_AZURE_IOT_SUCCESS Array start was appended successfully.

**Allowed From**

Initialization, Threads

**Example**

**See Also**

<div style="page-break-after: always;"></div>

**nx_azure_iot_json_writer_append_end_object**
***
<div style="text-align: right">Appends the end of the current JSON object</div>

**Prototype**
```c
UINT nx_azure_iot_json_writer_append_end_object(NX_AZURE_IOT_JSON_WRITER *json_writer_ptr);
```
**Description**

<p>Appends the end of the current JSON object (i.e. `}`).</p>

**Parameters**
| Name | Description |
| - |:-|
| json_writer_ptr [in]  | A pointer to an #NX_AZURE_IOT_JSON_WRITER. |

**Return Values**
* NX_AZURE_IOT_SUCCESS Object end was appended successfully.

**Allowed From**

Initialization, Threads

**Example**

**See Also**

<div style="page-break-after: always;"></div>

**nx_azure_iot_json_writer_append_end_array**
***
<div style="text-align: right">Appends the end of the current JSON array</div>

**Prototype**
```c
UINT nx_azure_iot_json_writer_append_end_array(NX_AZURE_IOT_JSON_WRITER *json_writer_ptr);
```
**Description**

<p>Appends the end of the current JSON array (i.e. `]`).</p>

**Parameters**
| Name | Description |
| - |:-|
| json_writer_ptr [in]  | A pointer to an #NX_AZURE_IOT_JSON_WRITER. |

**Return Values**
* NX_AZURE_IOT_SUCCESS Array end was appended successfully.

**Allowed From**

Initialization, Threads

**Example**

**See Also**

<div style="page-break-after: always;"></div>