├── .gitattributes ├── .gitignore ├── LICENSE ├── Source └── JsonDataObjects.pas ├── UnitTest ├── JsonDataObjectsTest.dpr ├── JsonDataObjectsTest.dproj └── TestJsonDataObjects.pas └── readme.md /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Uncomment these types if you want even more clean repository. But be careful. 2 | # It can make harm to an existing project source. Read explanations below. 3 | # 4 | # Resource files are binaries containing manifest, project icon and version info. 5 | # They can not be viewed as text or compared by diff-tools. Consider replacing them with .rc files. 6 | #*.res 7 | # 8 | # Type library file (binary). In old Delphi versions it should be stored. 9 | # Since Delphi 2009 it is produced from .ridl file and can safely be ignored. 10 | #*.tlb 11 | # 12 | # Diagram Portfolio file. Used by the diagram editor up to Delphi 7. 13 | # Uncomment this if you are not using diagrams or use newer Delphi version. 14 | #*.ddp 15 | # 16 | # Visual LiveBindings file. Added in Delphi XE2. 17 | # Uncomment this if you are not using LiveBindings Designer. 18 | #*.vlb 19 | # 20 | # Deployment Manager configuration file for your project. Added in Delphi XE2. 21 | # Uncomment this if it is not mobile development and you do not use remote debug feature. 22 | #*.deployproj 23 | # 24 | # C++ object files produced when C/C++ Output file generation is configured. 25 | # Uncomment this if you are not using external objects (zlib library for example). 26 | #*.obj 27 | # 28 | 29 | #Project structure 30 | bin/*** 31 | dcus/*** 32 | UnitTest/*.res 33 | 34 | # Delphi compiler-generated binaries (safe to delete) 35 | *.exe 36 | *.dll 37 | *.bpl 38 | *.bpi 39 | *.dcp 40 | *.so 41 | *.apk 42 | *.drc 43 | *.map 44 | *.dres 45 | *.rsm 46 | *.tds 47 | *.dcu 48 | *.lib 49 | *.a 50 | *.o 51 | *.ocx 52 | 53 | # Delphi autogenerated files (duplicated info) 54 | *.cfg 55 | *.hpp 56 | *Resource.rc 57 | 58 | # Delphi local files (user-specific info) 59 | *.local 60 | *.identcache 61 | *.projdata 62 | *.tvsconfig 63 | *.dsk 64 | 65 | # Delphi history and backups 66 | __history/ 67 | __recovery/ 68 | *.~* 69 | 70 | # Castalia statistics file (since XE7 Castalia is distributed with Delphi) 71 | *.stat 72 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Andreas Hausladen 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /UnitTest/JsonDataObjectsTest.dpr: -------------------------------------------------------------------------------- 1 | program JsonDataObjectsTest; 2 | 3 | {$IFDEF CONSOLE_TESTRUNNER} 4 | {$APPTYPE CONSOLE} 5 | {$ENDIF} 6 | 7 | uses 8 | DUnitTestRunner, 9 | JsonDataObjects in '..\Source\JsonDataObjects.pas', 10 | TestJsonDataObjects in 'TestJsonDataObjects.pas'; 11 | 12 | {$R *.RES} 13 | 14 | begin 15 | ReportMemoryLeaksOnShutdown := True; 16 | DUnitTestRunner.RunRegisteredTests; 17 | end. 18 | 19 | -------------------------------------------------------------------------------- /UnitTest/JsonDataObjectsTest.dproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | {F49CE5D1-5F92-4B39-A90B-73AF6EC198E8} 4 | 19.3 5 | None 6 | True 7 | Debug 8 | Win64 9 | 3 10 | Console 11 | JsonDataObjectsTest.dpr 12 | 13 | 14 | true 15 | 16 | 17 | true 18 | Base 19 | true 20 | 21 | 22 | true 23 | Base 24 | true 25 | 26 | 27 | true 28 | Base 29 | true 30 | 31 | 32 | true 33 | Base 34 | true 35 | 36 | 37 | true 38 | Cfg_1 39 | true 40 | true 41 | 42 | 43 | true 44 | Cfg_1 45 | true 46 | true 47 | 48 | 49 | true 50 | Base 51 | true 52 | 53 | 54 | true 55 | Cfg_2 56 | true 57 | true 58 | 59 | 60 | $(BDS)\bin\delphi_PROJECTICON.ico 61 | $(BDS)\bin\delphi_PROJECTICNS.icns 62 | JsonDataObjectsTest 63 | CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= 64 | _CONSOLE_TESTRUNNER;$(DCC_Define) 65 | System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace) 66 | $(BDS)\Source\DUnit\src;$(DCC_UnitSearchPath) 67 | 1031 68 | $(BDS)\bin\default_app.manifest 69 | ..\dcus\$(Platform)\$(Config) 70 | ..\bin\$(Platform)\$(Config) 71 | false 72 | false 73 | false 74 | false 75 | false 76 | 77 | 78 | true 79 | Base 80 | true 81 | $(BDS)\bin\Artwork\Android\FM_SplashImage_470x320.png 82 | $(BDS)\bin\Artwork\Android\FM_SplashImage_640x480.png 83 | $(BDS)\bin\Artwork\Android\FM_SplashImage_960x720.png 84 | true 85 | true 86 | true 87 | true 88 | $(BDS)\bin\Artwork\Android\FM_LauncherIcon_48x48.png 89 | true 90 | true 91 | true 92 | $(BDS)\bin\Artwork\Android\FM_LauncherIcon_72x72.png 93 | package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey= 94 | android-support-v4.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services.dex.jar 95 | $(BDS)\bin\Artwork\Android\FM_SplashImage_426x320.png 96 | $(BDS)\bin\Artwork\Android\FM_LauncherIcon_144x144.png 97 | $(BDS)\bin\Artwork\Android\FM_LauncherIcon_36x36.png 98 | Debug 99 | true 100 | true 101 | true 102 | $(BDS)\bin\Artwork\Android\FM_LauncherIcon_96x96.png 103 | 104 | 105 | Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) 106 | 1033 107 | 108 | 109 | Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) 110 | 1033 111 | 112 | 113 | true 114 | DEBUG;$(DCC_Define) 115 | 116 | 117 | 1033 118 | false 119 | 120 | 121 | true 122 | 1033 123 | 124 | 125 | false 126 | RELEASE;$(DCC_Define) 127 | 0 128 | 0 129 | 130 | 131 | 1033 132 | 133 | 134 | 135 | MainSource 136 | 137 | 138 | 139 | 140 | Base 141 | 142 | 143 | Cfg_1 144 | Base 145 | 146 | 147 | Cfg_2 148 | Base 149 | 150 | 151 | 152 | Delphi.Personality.12 153 | Application 154 | 155 | 156 | 157 | JsonDataObjectsTest.dpr 158 | 159 | 160 | 161 | 162 | 163 | true 164 | 165 | 166 | 167 | 168 | true 169 | 170 | 171 | 172 | 173 | JsonDataObjectsTest.exe 174 | true 175 | 176 | 177 | 178 | 179 | true 180 | 181 | 182 | 183 | 184 | true 185 | 186 | 187 | 188 | 189 | true 190 | 191 | 192 | 193 | 194 | 1 195 | 196 | 197 | Contents\MacOS 198 | 1 199 | 200 | 201 | 0 202 | 203 | 204 | 205 | 206 | classes 207 | 64 208 | 209 | 210 | classes 211 | 64 212 | 213 | 214 | 215 | 216 | classes 217 | 1 218 | 219 | 220 | 221 | 222 | res\xml 223 | 1 224 | 225 | 226 | res\xml 227 | 1 228 | 229 | 230 | 231 | 232 | library\lib\armeabi-v7a 233 | 1 234 | 235 | 236 | 237 | 238 | library\lib\armeabi 239 | 1 240 | 241 | 242 | library\lib\armeabi 243 | 1 244 | 245 | 246 | 247 | 248 | library\lib\armeabi-v7a 249 | 1 250 | 251 | 252 | 253 | 254 | library\lib\mips 255 | 1 256 | 257 | 258 | library\lib\mips 259 | 1 260 | 261 | 262 | 263 | 264 | 265 | library\lib\armeabi-v7a 266 | 1 267 | 268 | 269 | library\lib\arm64-v8a 270 | 1 271 | 272 | 273 | 274 | 275 | library\lib\armeabi-v7a 276 | 1 277 | 278 | 279 | 280 | 281 | res\drawable 282 | 1 283 | 284 | 285 | res\drawable 286 | 1 287 | 288 | 289 | 290 | 291 | res\values 292 | 1 293 | 294 | 295 | res\values 296 | 1 297 | 298 | 299 | 300 | 301 | res\values-v21 302 | 1 303 | 304 | 305 | res\values-v21 306 | 1 307 | 308 | 309 | 310 | 311 | res\values 312 | 1 313 | 314 | 315 | res\values 316 | 1 317 | 318 | 319 | 320 | 321 | res\drawable 322 | 1 323 | 324 | 325 | res\drawable 326 | 1 327 | 328 | 329 | 330 | 331 | res\drawable-xxhdpi 332 | 1 333 | 334 | 335 | res\drawable-xxhdpi 336 | 1 337 | 338 | 339 | 340 | 341 | res\drawable-xxxhdpi 342 | 1 343 | 344 | 345 | res\drawable-xxxhdpi 346 | 1 347 | 348 | 349 | 350 | 351 | res\drawable-ldpi 352 | 1 353 | 354 | 355 | res\drawable-ldpi 356 | 1 357 | 358 | 359 | 360 | 361 | res\drawable-mdpi 362 | 1 363 | 364 | 365 | res\drawable-mdpi 366 | 1 367 | 368 | 369 | 370 | 371 | res\drawable-hdpi 372 | 1 373 | 374 | 375 | res\drawable-hdpi 376 | 1 377 | 378 | 379 | 380 | 381 | res\drawable-xhdpi 382 | 1 383 | 384 | 385 | res\drawable-xhdpi 386 | 1 387 | 388 | 389 | 390 | 391 | res\drawable-mdpi 392 | 1 393 | 394 | 395 | res\drawable-mdpi 396 | 1 397 | 398 | 399 | 400 | 401 | res\drawable-hdpi 402 | 1 403 | 404 | 405 | res\drawable-hdpi 406 | 1 407 | 408 | 409 | 410 | 411 | res\drawable-xhdpi 412 | 1 413 | 414 | 415 | res\drawable-xhdpi 416 | 1 417 | 418 | 419 | 420 | 421 | res\drawable-xxhdpi 422 | 1 423 | 424 | 425 | res\drawable-xxhdpi 426 | 1 427 | 428 | 429 | 430 | 431 | res\drawable-xxxhdpi 432 | 1 433 | 434 | 435 | res\drawable-xxxhdpi 436 | 1 437 | 438 | 439 | 440 | 441 | res\drawable-small 442 | 1 443 | 444 | 445 | res\drawable-small 446 | 1 447 | 448 | 449 | 450 | 451 | res\drawable-normal 452 | 1 453 | 454 | 455 | res\drawable-normal 456 | 1 457 | 458 | 459 | 460 | 461 | res\drawable-large 462 | 1 463 | 464 | 465 | res\drawable-large 466 | 1 467 | 468 | 469 | 470 | 471 | res\drawable-xlarge 472 | 1 473 | 474 | 475 | res\drawable-xlarge 476 | 1 477 | 478 | 479 | 480 | 481 | res\values 482 | 1 483 | 484 | 485 | res\values 486 | 1 487 | 488 | 489 | 490 | 491 | 1 492 | 493 | 494 | Contents\MacOS 495 | 1 496 | 497 | 498 | 0 499 | 500 | 501 | 502 | 503 | Contents\MacOS 504 | 1 505 | .framework 506 | 507 | 508 | Contents\MacOS 509 | 1 510 | .framework 511 | 512 | 513 | Contents\MacOS 514 | 1 515 | .framework 516 | 517 | 518 | 0 519 | 520 | 521 | 522 | 523 | 1 524 | .dylib 525 | 526 | 527 | 1 528 | .dylib 529 | 530 | 531 | 1 532 | .dylib 533 | 534 | 535 | Contents\MacOS 536 | 1 537 | .dylib 538 | 539 | 540 | Contents\MacOS 541 | 1 542 | .dylib 543 | 544 | 545 | Contents\MacOS 546 | 1 547 | .dylib 548 | 549 | 550 | 0 551 | .dll;.bpl 552 | 553 | 554 | 555 | 556 | 1 557 | .dylib 558 | 559 | 560 | 1 561 | .dylib 562 | 563 | 564 | 1 565 | .dylib 566 | 567 | 568 | Contents\MacOS 569 | 1 570 | .dylib 571 | 572 | 573 | Contents\MacOS 574 | 1 575 | .dylib 576 | 577 | 578 | Contents\MacOS 579 | 1 580 | .dylib 581 | 582 | 583 | 0 584 | .bpl 585 | 586 | 587 | 588 | 589 | 0 590 | 591 | 592 | 0 593 | 594 | 595 | 0 596 | 597 | 598 | 0 599 | 600 | 601 | 0 602 | 603 | 604 | Contents\Resources\StartUp\ 605 | 0 606 | 607 | 608 | Contents\Resources\StartUp\ 609 | 0 610 | 611 | 612 | Contents\Resources\StartUp\ 613 | 0 614 | 615 | 616 | 0 617 | 618 | 619 | 620 | 621 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 622 | 1 623 | 624 | 625 | 626 | 627 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 628 | 1 629 | 630 | 631 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 632 | 1 633 | 634 | 635 | 636 | 637 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 638 | 1 639 | 640 | 641 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 642 | 1 643 | 644 | 645 | 646 | 647 | 1 648 | 649 | 650 | 1 651 | 652 | 653 | 1 654 | 655 | 656 | 657 | 658 | 1 659 | 660 | 661 | 1 662 | 663 | 664 | 1 665 | 666 | 667 | 668 | 669 | 1 670 | 671 | 672 | 1 673 | 674 | 675 | 1 676 | 677 | 678 | 679 | 680 | ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 681 | 1 682 | 683 | 684 | ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 685 | 1 686 | 687 | 688 | 689 | 690 | 1 691 | 692 | 693 | 1 694 | 695 | 696 | 1 697 | 698 | 699 | 700 | 701 | ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 702 | 1 703 | 704 | 705 | ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 706 | 1 707 | 708 | 709 | 710 | 711 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 712 | 1 713 | 714 | 715 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 716 | 1 717 | 718 | 719 | 720 | 721 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 722 | 1 723 | 724 | 725 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 726 | 1 727 | 728 | 729 | 730 | 731 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 732 | 1 733 | 734 | 735 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 736 | 1 737 | 738 | 739 | 740 | 741 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 742 | 1 743 | 744 | 745 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 746 | 1 747 | 748 | 749 | 750 | 751 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 752 | 1 753 | 754 | 755 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 756 | 1 757 | 758 | 759 | 760 | 761 | ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 762 | 1 763 | 764 | 765 | ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 766 | 1 767 | 768 | 769 | 770 | 771 | 1 772 | 773 | 774 | 1 775 | 776 | 777 | 1 778 | 779 | 780 | 781 | 782 | ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 783 | 1 784 | 785 | 786 | ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 787 | 1 788 | 789 | 790 | 791 | 792 | 1 793 | 794 | 795 | 1 796 | 797 | 798 | 1 799 | 800 | 801 | 802 | 803 | 1 804 | 805 | 806 | 1 807 | 808 | 809 | 1 810 | 811 | 812 | 813 | 814 | ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 815 | 1 816 | 817 | 818 | ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 819 | 1 820 | 821 | 822 | 823 | 824 | ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 825 | 1 826 | 827 | 828 | ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 829 | 1 830 | 831 | 832 | 833 | 834 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 835 | 1 836 | 837 | 838 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 839 | 1 840 | 841 | 842 | 843 | 844 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 845 | 1 846 | 847 | 848 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 849 | 1 850 | 851 | 852 | 853 | 854 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 855 | 1 856 | 857 | 858 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 859 | 1 860 | 861 | 862 | 863 | 864 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 865 | 1 866 | 867 | 868 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 869 | 1 870 | 871 | 872 | 873 | 874 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 875 | 1 876 | 877 | 878 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 879 | 1 880 | 881 | 882 | 883 | 884 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 885 | 1 886 | 887 | 888 | ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 889 | 1 890 | 891 | 892 | 893 | 894 | 1 895 | 896 | 897 | 1 898 | 899 | 900 | 901 | 902 | ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF 903 | 1 904 | 905 | 906 | ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF 907 | 1 908 | 909 | 910 | 911 | 912 | 1 913 | 914 | 915 | 1 916 | 917 | 918 | 919 | 920 | ..\ 921 | 1 922 | 923 | 924 | ..\ 925 | 1 926 | 927 | 928 | 929 | 930 | 1 931 | 932 | 933 | 1 934 | 935 | 936 | 1 937 | 938 | 939 | 940 | 941 | ..\$(PROJECTNAME).launchscreen 942 | 64 943 | 944 | 945 | ..\$(PROJECTNAME).launchscreen 946 | 64 947 | 948 | 949 | 950 | 951 | 1 952 | 953 | 954 | 1 955 | 956 | 957 | 1 958 | 959 | 960 | 961 | 962 | ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF 963 | 1 964 | 965 | 966 | ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF 967 | 1 968 | 969 | 970 | 971 | 972 | ..\ 973 | 1 974 | 975 | 976 | ..\ 977 | 1 978 | 979 | 980 | ..\ 981 | 1 982 | 983 | 984 | 985 | 986 | Contents 987 | 1 988 | 989 | 990 | Contents 991 | 1 992 | 993 | 994 | Contents 995 | 1 996 | 997 | 998 | 999 | 1000 | Contents\Resources 1001 | 1 1002 | 1003 | 1004 | Contents\Resources 1005 | 1 1006 | 1007 | 1008 | Contents\Resources 1009 | 1 1010 | 1011 | 1012 | 1013 | 1014 | library\lib\armeabi-v7a 1015 | 1 1016 | 1017 | 1018 | library\lib\arm64-v8a 1019 | 1 1020 | 1021 | 1022 | 1 1023 | 1024 | 1025 | 1 1026 | 1027 | 1028 | 1 1029 | 1030 | 1031 | 1 1032 | 1033 | 1034 | Contents\MacOS 1035 | 1 1036 | 1037 | 1038 | Contents\MacOS 1039 | 1 1040 | 1041 | 1042 | Contents\MacOS 1043 | 1 1044 | 1045 | 1046 | 0 1047 | 1048 | 1049 | 1050 | 1051 | library\lib\armeabi-v7a 1052 | 1 1053 | 1054 | 1055 | 1056 | 1057 | 1 1058 | 1059 | 1060 | 1 1061 | 1062 | 1063 | 1064 | 1065 | Assets 1066 | 1 1067 | 1068 | 1069 | Assets 1070 | 1 1071 | 1072 | 1073 | 1074 | 1075 | Assets 1076 | 1 1077 | 1078 | 1079 | Assets 1080 | 1 1081 | 1082 | 1083 | 1084 | 1085 | 1086 | 1087 | 1088 | 1089 | 1090 | 1091 | 1092 | 1093 | 1094 | 1095 | 1096 | False 1097 | False 1098 | True 1099 | True 1100 | 1101 | 1102 | DUnit / Delphi Win32 1103 | GUI 1104 | 1105 | 1106 | 1107 | 1108 | 12 1109 | 1110 | 1111 | 1112 | 1113 | 1114 | -------------------------------------------------------------------------------- /UnitTest/TestJsonDataObjects.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahausladen/JsonDataObjects/f6e45c3ff16f5900d1ffc6bde416723255d81257/UnitTest/TestJsonDataObjects.pas -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | Json Data Objects 2 | ================= 3 | 4 | This Delphi unit contains a JSON parser that supports Delphi 2009-10Seattle and the platforms 5 | Win32, Win64 and ARM Android (MacOS and iOS may work). 6 | 7 | Clone with GIT 8 | -------------- 9 | ``` 10 | > git clone git@github.com:ahausladen/JsonDataObjects.git 11 | ``` 12 | or 13 | ``` 14 | > git clone https://github.com/ahausladen/JsonDataObjects.git 15 | ``` 16 | 17 | This will get you the Json Data Objects repository. 18 | 19 | How to install 20 | -------------- 21 | 1. Clone the JsonDataObjects repository 22 | 2. Add the JsonDataObjects.pas unit to your project. 23 | 24 | Features 25 | -------- 26 | * Fast dual JSON parser for parsing UTF8 and UTF16 without conversion 27 | * Automatic creation of arrays and objects 28 | * Easy access mode with implicit operators 29 | * Compact and formatted output modes 30 | * Variants support 31 | * Null can be auto-typecasted to a value type if JsonSerializationConfig.NullConvertsToValueTypes is set to True 32 | * Progress callback support for loading large JSON strings 33 | * Win32, Win64 and ARM Android support (MacOS and iOS may work) 34 | 35 | Usage 36 | ----- 37 | Simple example 38 | ```Delphi 39 | var 40 | Obj: TJsonObject; 41 | begin 42 | Obj := TJsonObject.Parse('{ "foo": "bar", "array": [ 10, 20 ] }') as TJsonObject; 43 | try 44 | ShowMessage(Obj['foo']); 45 | ShowMessage(IntToStr(Obj['array'].Count)); 46 | ShowMessage(IntToStr(Obj['array'].Items[0])); 47 | ShowMessage(IntToStr(Obj['array'].Items[1])); 48 | finally 49 | Obj.Free; 50 | end; 51 | end; 52 | ``` 53 | 54 | Filling and serializing JSON objects 55 | ```Delphi 56 | var 57 | Obj, ChildObj: TJsonObject; 58 | begin 59 | Obj := TJsonObject.Create; 60 | try 61 | // easy access 62 | Obj['foo'] := 'bar'; 63 | // normal (and faster) access 64 | Obj.S['bar'] := 'foo'; 65 | // automatic array creation, Obj is the owner of 'array' 66 | Obj.A['array'].Add(10); 67 | Obj.A['array'].Add(20); 68 | // automatic object creation, 'array' is the owner of ChildObj 69 | ChildObj := Obj.A['array'].AddObject; 70 | ChildObj['value'] := 12.3; 71 | // automatic array creation, ChildObj is the owner of 'subarray' 72 | ChildObj.A['subarray'].Add(100); 73 | ChildObj.A['subarray'].Add(200); 74 | 75 | ShowMessage(Obj.ToJSON({Compact:=}False)); 76 | finally 77 | Obj.Free; 78 | end; 79 | ``` 80 | ```JSON 81 | { 82 | "foo": "bar", 83 | "bar": "foo", 84 | "array": [ 85 | 10, 86 | 20, 87 | { 88 | "value": 12.3, 89 | "subarray": [ 90 | 100, 91 | 200 92 | ] 93 | } 94 | ] 95 | } 96 | ``` 97 | 98 | Copying JSON objects with `Assign` 99 | ```Delphi 100 | var 101 | Obj, ClonedObj: TJsonObject; 102 | begin 103 | Obj := TJsonObject.ParseUtf8('{ "foo": [ "bar", {}, null, true, false, { "key": "value" } ] }') as TJsonObject; 104 | try 105 | ClonedObj := TJsonObject.Create; 106 | try 107 | // Make a copy of Obj 108 | ClonedObj.Assign(Obj); 109 | ShowMessage(ClonedObj.ToJSON(False)); 110 | finally 111 | ClonedObj.Free; 112 | end; 113 | finally 114 | Obj.Free; 115 | end; 116 | end; 117 | ``` 118 | ```JSON 119 | { 120 | "foo": [ 121 | "bar", 122 | {}, 123 | null, 124 | true, 125 | false, 126 | { 127 | "key": "value" 128 | } 129 | ] 130 | } 131 | ``` --------------------------------------------------------------------------------