Skip to content

Commit 4d2c63d

Browse files
Add JSON Serializable API
The JSON Serializable API defines a base class for serializable classes ('JSON Serializable'), children of which are serialized using methods that they implement ('To JSON' and 'From JSON'). The serializer will only serialize classes that inherit from the JSON Serializable class. Any other class will have value 'null' in the JSON output and always returns the base type. The type of the object is always added with key "$type" in the JSON output (for any class). If a child class returns any non-object JSON value, it is stored with key "$data". Example { "$type":"My JSON Serializable.lvclass", "$data":[1,2,3] }
1 parent 3b3842d commit 4d2c63d

76 files changed

Lines changed: 454 additions & 4 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.vipb

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
<VI_Package_Builder_Settings Version="2018" Created_Date="2021-03-19 22:45:16" Modified_Date="2021-04-03 10:43:59" Creator="Pascal Neuperger" Comments="" ID="d0d45a23f9c47300a00d3fb0636dccb5">
1+
<VI_Package_Builder_Settings Version="2018" Created_Date="2021-03-19 22:45:16" Modified_Date="2021-04-04 17:58:11" Creator="Pascal Neuperger" Comments="" ID="3a18321c6e962c80a74f114c00463500">
22
<Library_General_Settings>
33
<Package_File_Name>PNR_lib_JSONtext_Object_Serialization</Package_File_Name>
4-
<Library_Version>0.0.1.16</Library_Version>
4+
<Library_Version>0.0.1.18</Library_Version>
55
<Auto_Increment_Version>false</Auto_Increment_Version>
66
<Library_Source_Folder>.</Library_Source_Folder>
77
<Library_Output_Folder>..</Library_Output_Folder>
@@ -42,7 +42,10 @@
4242
Object serialization ia a feature in JSONtext 1.5 and higher, which provides a class-based API to serialize objects from and to JSON. This package adds different strategies to the JSONtext palette.
4343

4444
&lt;b&gt;Flatten To JSON Object&lt;/b&gt;
45-
Represents LabVIEW Objects as composite JSON Object. Parent classes form a union with their child classes.</Description>
45+
Represents LabVIEW Objects as composite JSON Object. Parent classes form a union with their child classes.
46+
47+
&lt;b&gt;JSON Serializable Serializer&lt;/b&gt;
48+
Serializes objects that inherit from JSON Serializer.</Description>
4649
<Copyright>Copyright (c) 2021, Pascal Neuperger</Copyright>
4750
<Packager/>
4851
<URL>https://github.com/LogMANOriginal/JSONtext-Object-Serialization</URL>
@@ -161,6 +164,15 @@ Represents LabVIEW Objects as composite JSON Object. Parent classes form a union
161164
<Exclusions>
162165
<Path>Default Serialization Binder Tests</Path>
163166
</Exclusions>
167+
<Exclusions>
168+
<Path>JSON Serializable Binder Tests</Path>
169+
</Exclusions>
170+
<Exclusions>
171+
<Path>JSON Serializable Serializer Tests</Path>
172+
</Exclusions>
173+
<Exclusions>
174+
<Path>JSON Serializable Tests</Path>
175+
</Exclusions>
164176
</Source_Files>
165177
<License_Agreement_Filepath>LICENSE.txt</License_Agreement_Filepath>
166178
<Licensing_and_Activation>
@@ -263,7 +275,21 @@ Represents LabVIEW Objects as composite JSON Object. Parent classes form a union
263275
<Path>Flatten To JSON Object (Constant).vi</Path>
264276
<VI_Title/>
265277
</Items_Data>
266-
<GUID>FB5B7E407AB9F383B7546FACB90F5761</GUID>
278+
<Items_Data>
279+
<Type>Item</Type>
280+
<Sub_Palette_Index>-1</Sub_Palette_Index>
281+
<NameSub_Menu_Name>JSON Serializable Serializer</NameSub_Menu_Name>
282+
<Short_Name/>
283+
<is_Merge_VI>true</is_Merge_VI>
284+
<Position>
285+
<Row>1</Row>
286+
<Column>2</Column>
287+
</Position>
288+
<Icon>00000000</Icon>
289+
<Path>JSON Serializable Serializer (Constant).vi</Path>
290+
<VI_Title/>
291+
</Items_Data>
292+
<GUID>C1EA57688500E3438F80654BEC0FB988</GUID>
267293
</Functions_Palette_Data>
268294
</Library_Palette_Definition>
269295
</VI_Package_Builder_Settings>
51.3 KB
Binary file not shown.
2.01 KB
Binary file not shown.
22.6 KB
Binary file not shown.
22 KB
Binary file not shown.
18.7 KB
Binary file not shown.

Examples/Serializable Account/Serializable Account.lvclass

Lines changed: 66 additions & 0 deletions
Large diffs are not rendered by default.
21.4 KB
Binary file not shown.
51.6 KB
Binary file not shown.
4 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)