Objectively
Ultra-lightweight object oriented framework for GNU C.
Loading...
Searching...
No Matches
JSONSerializers.c
Go to the documentation of this file.
1/*
2 * Objectively: Ultra-lightweight object oriented framework for GNU C.
3 * Copyright (C) 2014 Jay Dolan <jay@jaydolan.com>
4 *
5 * This software is provided 'as-is', without any express or implied
6 * warranty. In no event will the authors be held liable for any damages
7 * arising from the use of this software.
8 *
9 * Permission is granted to anyone to use this software for any purpose,
10 * including commercial applications, and to alter it and redistribute it
11 * freely, subject to the following restrictions:
12 *
13 * 1. The origin of this software must not be misrepresented; you must not
14 * claim that you wrote the original software. If you use this software
15 * in a product, an acknowledgment in the product documentation would be
16 * appreciated but is not required.
17 *
18 * 2. Altered source versions must be plainly marked as such, and must not be
19 * misrepresented as being the original software.
20 *
21 * 3. This notice may not be removed or altered from any source distribution.
22 */
23
24#include <stdint.h>
25#include <stdlib.h>
26#include <string.h>
27
28#include "Boole.h"
29#include "Date.h"
30#include "DateFormatter.h"
31#include "JSONContext.h"
32#include "Array.h"
33#include "Dictionary.h"
34#include "Set.h"
35#include "Null.h"
36#include "Number.h"
37#include "String.h"
38#include "URL.h"
39
40#pragma mark - Standard serializers
41
43 const JSONProperty *property,
44 ident value,
45 ident data,
46 JSONContext *context) {
47
48 (void) properties;
49 (void) property;
50 (void) data;
51 (void) context;
52
53 const char *s = value;
54 if (s && s[0]) {
55 return (ident) $$(String, stringWithCharacters, s);
56 }
57
58 return NULL;
59}
60
62 const JSONProperty *property,
63 ident value,
64 ident data,
65 JSONContext *context) {
66
67 (void) properties;
68 (void) property;
69 (void) data;
70 (void) context;
71
72 const char *const *s = value;
73 if (s && *s) {
74 return (ident) $$(String, stringWithCharacters, *s);
75 }
76
77 return NULL;
78}
79
81 const JSONProperty *property,
82 ident value,
83 ident data,
84 JSONContext *context) {
85
86 (void) properties;
87 (void) property;
88 (void) data;
89 (void) context;
90
91 if (!value) {
92 return NULL;
93 }
94
95 return (ident) $$(Number, numberWithValue, (double) *(const int32_t *) value);
96}
97
99 const JSONProperty *property,
100 ident value,
101 ident data,
102 JSONContext *context) {
103
104 (void) properties;
105 (void) property;
106 (void) data;
107 (void) context;
108
109 if (!value) {
110 return NULL;
111 }
112
113 return (ident) $$(Number, numberWithValue, (double) *(const uint32_t *) value);
114}
115
117 const JSONProperty *property,
118 ident value,
119 ident data,
120 JSONContext *context) {
121
122 (void) properties;
123 (void) property;
124 (void) data;
125 (void) context;
126
127 if (!value) {
128 return NULL;
129 }
130
131 return (ident) $$(Number, numberWithValue, (double) *(const int64_t *) value);
132}
133
135 const JSONProperty *property,
136 ident value,
137 ident data,
138 JSONContext *context) {
139
140 (void) properties;
141 (void) property;
142 (void) data;
143 (void) context;
144
145 if (!value) {
146 return NULL;
147 }
148
149 return (ident) $$(Number, numberWithValue, (double) *(const uint64_t *) value);
150}
151
153 const JSONProperty *property,
154 ident value,
155 ident data,
156 JSONContext *context) {
157
158 (void) properties;
159 (void) property;
160 (void) data;
161 (void) context;
162
163 if (!value) {
164 return NULL;
165 }
166
167 return (ident) $$(Number, numberWithValue, (double) *(const float *) value);
168}
169
171 const JSONProperty *property,
172 ident value,
173 ident data,
174 JSONContext *context) {
175
176 (void) properties;
177 (void) property;
178 (void) data;
179 (void) context;
180
181 if (!value) {
182 return NULL;
183 }
184
185 return (ident) $$(Number, numberWithValue, *(const double *) value);
186}
187
189 const JSONProperty *property,
190 ident value,
191 ident data,
192 JSONContext *context) {
193
194 (void) properties;
195 (void) property;
196 (void) data;
197 (void) context;
198
199 if (!value) {
200 return NULL;
201 }
202
203 return retain(*(const bool *) value ? $$(Boole, True) : $$(Boole, False));
204}
205
207 const JSONProperty *property,
208 ident value,
209 ident data,
210 JSONContext *context) {
211
212 (void) properties;
213 (void) property;
214
215 const JSONProperties *child = data;
216 if (!child || !child->properties || !value) {
217 return NULL;
218 }
219
220 return (ident) $(context, dictionaryFromStruct, child, value);
221}
222
224 const JSONProperty *property,
225 ident value,
226 ident data,
227 JSONContext *context) {
228
229 (void) properties;
230 (void) property;
231
233 if (!array || !array->properties || !value) {
234 return NULL;
235 }
236
237 Array *out = $(alloc(Array), init);
238
239 for (size_t i = 0; i < array->capacity; i++) {
240 const ident instance = (uint8_t *) value + i * array->properties->size;
241 Dictionary *dict = $(context, dictionaryFromStruct, array->properties, instance);
242 $(out, addObject, dict);
243 release(dict);
244 }
245
246 return (ident) out;
247}
248
249#pragma mark - Standard deserializers
250
252 const JSONProperty *property,
253 const Object *value,
254 ident field,
255 JSONContext *context) {
256
257 (void) properties;
258 (void) context;
259
260 char *dest = field;
261 const size_t size = property->size;
262
263 if (!dest || !size) {
264 return false;
265 }
266
267 memset(dest, 0, size);
268
269 if (!$(value, isKindOfClass, _String())) {
270 return false;
271 }
272
273 strncpy(dest, cast(String, value)->chars, size - 1);
274 dest[size - 1] = '\0';
275 return true;
276}
277
279 const JSONProperty *property,
280 const Object *value,
281 ident field,
282 JSONContext *context) {
283
284 (void) properties;
285 (void) property;
286 (void) context;
287
288 char **dest = field;
289 if (!dest) {
290 return false;
291 }
292
293 free(*dest);
294 *dest = NULL;
295
296 if (!$(value, isKindOfClass, _String())) {
297 return false;
298 }
299
300 *dest = strdup(cast(String, value)->chars);
301 return true;
302}
303
305 const JSONProperty *property,
306 const Object *value,
307 ident field,
308 JSONContext *context) {
309
310 (void) properties;
311 (void) property;
312 (void) context;
313
314 int32_t *dest = field;
315 if (!dest) {
316 return false;
317 }
318
319 *dest = 0;
320
321 if (!$(value, isKindOfClass, _Number())) {
322 return false;
323 }
324
325 *dest = (int32_t) cast(Number, value)->value;
326 return true;
327}
328
330 const JSONProperty *property,
331 const Object *value,
332 ident field,
333 JSONContext *context) {
334
335 (void) properties;
336 (void) property;
337 (void) context;
338
339 uint32_t *dest = field;
340 if (!dest) {
341 return false;
342 }
343
344 *dest = 0;
345
346 if (!$(value, isKindOfClass, _Number())) {
347 return false;
348 }
349
350 *dest = (uint32_t) cast(Number, value)->value;
351 return true;
352}
353
355 const JSONProperty *property,
356 const Object *value,
357 ident field,
358 JSONContext *context) {
359
360 (void) properties;
361 (void) property;
362 (void) context;
363
364 int64_t *dest = field;
365 if (!dest) {
366 return false;
367 }
368
369 *dest = 0;
370
371 if (!$(value, isKindOfClass, _Number())) {
372 return false;
373 }
374
375 *dest = (int64_t) cast(Number, value)->value;
376 return true;
377}
378
380 const JSONProperty *property,
381 const Object *value,
382 ident field,
383 JSONContext *context) {
384
385 (void) properties;
386 (void) property;
387 (void) context;
388
389 uint64_t *dest = field;
390 if (!dest) {
391 return false;
392 }
393
394 *dest = 0;
395
396 if (!$(value, isKindOfClass, _Number())) {
397 return false;
398 }
399
400 *dest = (uint64_t) cast(Number, value)->value;
401 return true;
402}
403
405 const JSONProperty *property,
406 const Object *value,
407 ident field,
408 JSONContext *context) {
409
410 (void) properties;
411 (void) property;
412 (void) context;
413
414 float *dest = field;
415 if (!dest) {
416 return false;
417 }
418
419 *dest = 0.f;
420
421 if (!$(value, isKindOfClass, _Number())) {
422 return false;
423 }
424
425 *dest = (float) cast(Number, value)->value;
426 return true;
427}
428
430 const JSONProperty *property,
431 const Object *value,
432 ident field,
433 JSONContext *context) {
434
435 (void) properties;
436 (void) property;
437 (void) context;
438
439 double *dest = field;
440 if (!dest) {
441 return false;
442 }
443
444 *dest = 0.0;
445
446 if (!$(value, isKindOfClass, _Number())) {
447 return false;
448 }
449
450 *dest = cast(Number, value)->value;
451 return true;
452}
453
455 const JSONProperty *property,
456 const Object *value,
457 ident field,
458 JSONContext *context) {
459
460 (void) properties;
461 (void) property;
462 (void) context;
463
464 bool *dest = field;
465 if (!dest) {
466 return false;
467 }
468
469 *dest = false;
470
471 if (!$(value, isKindOfClass, _Boole())) {
472 return false;
473 }
474
475 *dest = cast(Boole, value)->value;
476 return true;
477}
478
480 const JSONProperty *property,
481 const Object *value,
482 ident field,
483 JSONContext *context) {
484
485 (void) properties;
486
487 const JSONProperties *child = property->data;
488 if (!child || !child->properties || !field) {
489 return false;
490 }
491
492 memset(field, 0, child->size);
493
494 if (!$(value, isKindOfClass, _Dictionary())) {
495 return false;
496 }
497
498 return $(context, structFromDictionary, child, cast(Dictionary, value), field);
499}
500
502 const JSONProperty *property,
503 const Object *value,
504 ident field,
505 JSONContext *context) {
506
507 (void) properties;
508
509 const JSONArrayProperties *array = property->data;
510 if (!array || !array->properties || !field) {
511 return false;
512 }
513
514 uint8_t *instance = (uint8_t *) field - property->offset;
516 *(size_t *) (instance + array->count) = 0;
517 }
518
519 memset(field, 0, array->properties->size * array->capacity);
520
521 if (!$(value, isKindOfClass, _Array())) {
522 return false;
523 }
524
525 const size_t n = $(context, structsFromArray, array->properties,
526 cast(Array, value), field, array->capacity);
527
529 *(size_t *) (instance + array->count) = n;
530 }
531
532 return true;
533}
534
535#pragma mark - Object serializers / deserializers
536
538 const JSONProperty *property,
539 ident value,
540 ident data,
541 JSONContext *context) {
542
543 (void) properties;
544 (void) property;
545 (void) data;
546 (void) context;
547
548 String **s = value;
549 return *s ? retain(*s) : NULL;
550}
551
553 const JSONProperty *property,
554 const Object *value,
555 ident field,
556 JSONContext *context) {
557
558 (void) properties;
559 (void) property;
560 (void) context;
561
562 String **dest = field;
563 release(*dest);
564 *dest = NULL;
565
566 if (!$(value, isKindOfClass, _String())) {
567 return false;
568 }
569
570 *dest = retain((String *) value);
571 return true;
572}
573
575 const JSONProperty *property,
576 ident value,
577 ident data,
578 JSONContext *context) {
579
580 (void) properties;
581 (void) property;
582 (void) data;
583 (void) context;
584
585 URL **url = value;
586 return *url ? retain((*url)->urlString) : NULL;
587}
588
589bool JSONDeserializeURL(const JSONProperties *properties,
590 const JSONProperty *property,
591 const Object *value,
592 ident field,
593 JSONContext *context) {
594
595 (void) properties;
596 (void) property;
597 (void) context;
598
599 URL **dest = field;
600 release(*dest);
601 *dest = NULL;
602
603 if (!$(value, isKindOfClass, _String())) {
604 return false;
605 }
606
607 *dest = $(alloc(URL), initWithString, cast(String, value));
608 return *dest != NULL;
609}
610
612 const JSONProperty *property,
613 ident value,
614 ident data,
615 JSONContext *context) {
616
617 (void) properties;
618 (void) context;
619
620 Date **date = value;
621 if (!*date) {
622 return NULL;
623 }
624
625 const char *fmt = data ? (const char *) data : DATEFORMAT_ISO8601;
626 DateFormatter *formatter = $(alloc(DateFormatter), initWithFormat, fmt);
627 String *string = $(formatter, stringFromDate, *date);
628 release(formatter);
629 return string;
630}
631
632bool JSONDeserializeDate(const JSONProperties *properties,
633 const JSONProperty *property,
634 const Object *value,
635 ident field,
636 JSONContext *context) {
637
638 (void) properties;
639 (void) context;
640
641 Date **dest = field;
642 release(*dest);
643 *dest = NULL;
644
645 if (!$(value, isKindOfClass, _String())) {
646 return false;
647 }
648
649 const char *fmt = property->data ? (const char *) property->data : DATEFORMAT_ISO8601;
650 DateFormatter *formatter = $(alloc(DateFormatter), initWithFormat, fmt);
651 *dest = $(formatter, dateFromString, cast(String, value));
652 release(formatter);
653 return *dest != NULL;
654}
655
657 const JSONProperty *property,
658 ident value,
659 ident data,
660 JSONContext *context) {
661
662 (void) properties;
663 (void) property;
664 (void) data;
665 (void) context;
666
667 Array **arr = value;
668 return *arr ? retain(*arr) : NULL;
669}
670
672 const JSONProperty *property,
673 const Object *value,
674 ident field,
675 JSONContext *context) {
676
677 (void) properties;
678 (void) property;
679 (void) context;
680
681 Array **dest = field;
682 release(*dest);
683 *dest = NULL;
684
685 if (!$(value, isKindOfClass, _Array())) {
686 return false;
687 }
688
689 const Array *src = cast(Array, value);
690 *dest = $(alloc(Array), initWithCapacity, src->count);
691 $(*(Array **) dest, addObjectsFromArray, src);
692 return true;
693}
694
696 const JSONProperty *property,
697 ident value,
698 ident data,
699 JSONContext *context) {
700
701 (void) properties;
702 (void) property;
703 (void) data;
704 (void) context;
705
706 Set **set = value;
707 if (!*set) {
708 return NULL;
709 }
710
711 return (ident) $(cast(Set, *set), allObjects);
712}
713
714bool JSONDeserializeSet(const JSONProperties *properties,
715 const JSONProperty *property,
716 const Object *value,
717 ident field,
718 JSONContext *context) {
719
720 (void) properties;
721 (void) property;
722 (void) context;
723
724 Set **dest = field;
725 release(*dest);
726 *dest = NULL;
727
728 if (!$(value, isKindOfClass, _Array())) {
729 return false;
730 }
731
732 const Array *src = cast(Array, value);
733 *dest = $(alloc(Set), initWithCapacity, src->count);
734 $(*(Set **) dest, addObjectsFromArray, src);
735 return true;
736}
737
739 const JSONProperty *property,
740 ident value,
741 ident data,
742 JSONContext *context) {
743
744 (void) properties;
745 (void) property;
746 (void) data;
747 (void) context;
748
749 Dictionary **dict = value;
750 return *dict ? retain(*dict) : NULL;
751}
752
754 const JSONProperty *property,
755 const Object *value,
756 ident field,
757 JSONContext *context) {
758
759 (void) properties;
760 (void) property;
761 (void) context;
762
763 Dictionary **dest = field;
764 release(*dest);
765 *dest = NULL;
766
767 if (!$(value, isKindOfClass, _Dictionary())) {
768 return false;
769 }
770
771 *dest = $(alloc(Dictionary), init);
772 $(*(Dictionary **) dest, addEntriesFromDictionary, cast(Dictionary, value));
773 return true;
774}
Class * _Array(void)
Definition Array.c:760
static Array * initWithCapacity(Array *self, size_t capacity)
Definition Array.c:453
static void addObjectsFromArray(Array *self, const Array *array)
Definition Array.c:221
static void addObject(Array *self, const ident obj)
Definition Array.c:181
static Array * array(void)
Definition Array.c:234
static Array * init(Array *self)
Definition Array.c:420
Arrays.
static Boole * True(void)
Definition Boole.c:77
Class * _Boole(void)
Definition Boole.c:125
static Boole * False(void)
Definition Boole.c:59
A wrapper for placing boolean primitives into collections, etc.
ident release(ident obj)
Atomically decrement the given Object's reference count. If the resulting reference count is 0,...
Definition Class.c:195
ident retain(ident obj)
Atomically increment the given Object's reference count.
Definition Class.c:210
#define alloc(type)
Allocate and initialize and instance of type.
Definition Class.h:176
#define cast(type, obj)
Safely cast obj to type.
Definition Class.h:182
static Data * data(void)
Definition Data.c:286
static Date * date(void)
Definition Date.c:98
Microsecond-precision immutable dates.
static String * stringFromDate(const DateFormatter *self, const Date *date)
static Date * dateFromString(const DateFormatter *self, const String *string)
static DateFormatter * initWithFormat(DateFormatter *self, const char *fmt)
Date formatting and parsing.
#define DATEFORMAT_ISO8601
ISO8601 date format.
Class * _Dictionary(void)
Definition Dictionary.c:762
static Array * allObjects(const Dictionary *self)
Definition Dictionary.c:213
static void addEntriesFromDictionary(Dictionary *self, const Dictionary *dictionary)
Definition Dictionary.c:175
Key-value stores.
static Dictionary * dictionaryFromStruct(JSONContext *self, const JSONProperties *properties, const ident instance)
Serializes a C struct instance to a Dictionary.
static size_t structsFromArray(JSONContext *self, const JSONProperties *properties, const Array *array, ident instances, size_t count)
Deserializes a JSON Array into an array of C structs.
static bool structFromDictionary(JSONContext *self, const JSONProperties *properties, const Dictionary *dictionary, ident instance)
Deserializes a Dictionary into a C struct.
JSONContext class for JSON serialization and deserialization.
bool JSONDeserializeDouble(const JSONProperties *properties, const JSONProperty *property, const Object *value, ident field, JSONContext *context)
Deserializes a JSON number into a double field.
bool JSONDeserializeDate(const JSONProperties *properties, const JSONProperty *property, const Object *value, ident field, JSONContext *context)
Deserializes a JSON string into a Date * field (ISO 8601 by default).
bool JSONDeserializeCString(const JSONProperties *properties, const JSONProperty *property, const Object *value, ident field, JSONContext *context)
Deserializes a JSON string into a heap-allocated char * field.
bool JSONDeserializeInt32(const JSONProperties *properties, const JSONProperty *property, const Object *value, ident field, JSONContext *context)
Deserializes a JSON number into an int32_t field.
ident JSONSerializeUint32(const JSONProperties *properties, const JSONProperty *property, ident value, ident data, JSONContext *context)
Serializes a uint32_t field to a JSON number.
bool JSONDeserializeFloat(const JSONProperties *properties, const JSONProperty *property, const Object *value, ident field, JSONContext *context)
Deserializes a JSON number into a float field.
bool JSONDeserializeObjectArray(const JSONProperties *properties, const JSONProperty *property, const Object *value, ident field, JSONContext *context)
Deserializes a JSON array into an Array * field.
ident JSONSerializeStruct(const JSONProperties *properties, const JSONProperty *property, ident value, ident data, JSONContext *context)
Serializes a nested struct field to a JSON object.
ident JSONSerializeArray(const JSONProperties *properties, const JSONProperty *property, ident value, ident data, JSONContext *context)
Serializes an inline array field to a JSON array.
bool JSONDeserializeBoole(const JSONProperties *properties, const JSONProperty *property, const Object *value, ident field, JSONContext *context)
Deserializes a JSON boolean into a bool field.
bool JSONDeserializeCharacters(const JSONProperties *properties, const JSONProperty *property, const Object *value, ident field, JSONContext *context)
Deserializes a JSON string into a fixed-size char[] field.
bool JSONDeserializeArray(const JSONProperties *properties, const JSONProperty *property, const Object *value, ident field, JSONContext *context)
Deserializes a JSON array into an inline array field.
ident JSONSerializeInt64(const JSONProperties *properties, const JSONProperty *property, ident value, ident data, JSONContext *context)
Serializes an int64_t field to a JSON number.
ident JSONSerializeCString(const JSONProperties *properties, const JSONProperty *property, ident value, ident data, JSONContext *context)
Serializes a char * heap string field to a JSON string.
ident JSONSerializeURL(const JSONProperties *properties, const JSONProperty *property, ident value, ident data, JSONContext *context)
Serializes a URL * field to a JSON string (the URL's string form).
bool JSONDeserializeUint32(const JSONProperties *properties, const JSONProperty *property, const Object *value, ident field, JSONContext *context)
Deserializes a JSON number into a uint32_t field.
bool JSONDeserializeString(const JSONProperties *properties, const JSONProperty *property, const Object *value, ident field, JSONContext *context)
Deserializes a JSON string into a String * field.
ident JSONSerializeDictionary(const JSONProperties *properties, const JSONProperty *property, ident value, ident data, JSONContext *context)
Serializes a Dictionary * field to a JSON object.
ident JSONSerializeCharacters(const JSONProperties *properties, const JSONProperty *property, ident value, ident data, JSONContext *context)
Serializes a fixed-size char[] field to a JSON string.
ident JSONSerializeInt32(const JSONProperties *properties, const JSONProperty *property, ident value, ident data, JSONContext *context)
Serializes an int32_t field to a JSON number.
ident JSONSerializeObjectArray(const JSONProperties *properties, const JSONProperty *property, ident value, ident data, JSONContext *context)
Serializes an Array * field to a JSON array.
ident JSONSerializeSet(const JSONProperties *properties, const JSONProperty *property, ident value, ident data, JSONContext *context)
Serializes a Set * field to a JSON array.
bool JSONDeserializeDictionary(const JSONProperties *properties, const JSONProperty *property, const Object *value, ident field, JSONContext *context)
Deserializes a JSON object into a Dictionary * field.
bool JSONDeserializeStruct(const JSONProperties *properties, const JSONProperty *property, const Object *value, ident field, JSONContext *context)
Deserializes a JSON object into a nested struct field.
bool JSONDeserializeURL(const JSONProperties *properties, const JSONProperty *property, const Object *value, ident field, JSONContext *context)
Deserializes a JSON string into a URL * field via initWithString.
ident JSONSerializeBoole(const JSONProperties *properties, const JSONProperty *property, ident value, ident data, JSONContext *context)
Serializes a bool field to a JSON boolean.
bool JSONDeserializeInt64(const JSONProperties *properties, const JSONProperty *property, const Object *value, ident field, JSONContext *context)
Deserializes a JSON number into an int64_t field.
ident JSONSerializeUint64(const JSONProperties *properties, const JSONProperty *property, ident value, ident data, JSONContext *context)
Serializes a uint64_t field to a JSON number.
bool JSONDeserializeSet(const JSONProperties *properties, const JSONProperty *property, const Object *value, ident field, JSONContext *context)
Deserializes a JSON array into a Set * field.
ident JSONSerializeString(const JSONProperties *properties, const JSONProperty *property, ident value, ident data, JSONContext *context)
Serializes a String * field to a JSON string.
ident JSONSerializeFloat(const JSONProperties *properties, const JSONProperty *property, ident value, ident data, JSONContext *context)
Serializes a float field to a JSON number.
ident JSONSerializeDouble(const JSONProperties *properties, const JSONProperty *property, ident value, ident data, JSONContext *context)
Serializes a double field to a JSON number.
ident JSONSerializeDate(const JSONProperties *properties, const JSONProperty *property, ident value, ident data, JSONContext *context)
Serializes a Date * field to a JSON string (ISO 8601 by default).
bool JSONDeserializeUint64(const JSONProperties *properties, const JSONProperty *property, const Object *value, ident field, JSONContext *context)
Deserializes a JSON number into a uint64_t field.
#define JSONArrayProperties_NoCount
Sentinel for JSONArrayProperties::count indicating no sibling count field.
The Null sentinel.
static Number * numberWithValue(double value)
Definition Number.c:159
Class * _Number(void)
Definition Number.c:198
A wrapper for placing numeric primitives into collections, etc.
static bool isKindOfClass(const Object *self, const Class *clazz)
Definition Object.c:101
static Set * set(void)
Definition Set.c:572
Sets.
static String * initWithString(String *self, const String *string)
Definition String.c:716
static String * string(void)
Definition String.c:905
static String * stringWithCharacters(const char *chars)
Definition String.c:349
Class * _String(void)
Definition String.c:999
UTF-8 strings.
void * ident
The identity type, similar to Objective-C id.
Definition Types.h:49
Uniform Resource Locators (RFC 3986).
Arrays.
Definition Array.h:56
size_t count
The count of elements.
Definition Array.h:72
A wrapper for placing boolean primitives into collections, etc.
Definition Boole.h:41
Date formatting and parsing.
Microsecond-precision immutable dates.
Definition Date.h:74
Key-value stores.
Definition Dictionary.h:60
Describes the JSON binding for an inline array field of a C struct.
A context for JSON serialization and deserialization.
Definition JSONContext.h:72
Describes the JSON binding for all fields of a C struct.
const JSONProperty * properties
The NULL-terminated JSONProperty array.
size_t size
The struct size, i.e. sizeof(Struct).
Describes the JSON binding strategy for a single field of a C struct.
ptrdiff_t offset
The byte offset of the field within the struct.
ident data
Opaque user data passed to the serializer and deserializer.
A wrapper for placing numeric primitives into collections, etc.
Definition Number.h:41
Object is the root Class of The Objectively Class hierarchy.
Definition Object.h:46
Sets.
Definition Set.h:55
UTF-8 strings.
Definition String.h:69
Uniform Resource Locators (RFC 3986).
Definition URL.h:44