Skip to content

Commit c3537e2

Browse files
Fix pretty print does not work when type name handling is enabled
When type name handling is enabled, the pretty print status does not affect the JSON output. The problem is that type name handling currently ignores pretty print and simply adds the value. Additionally, the Merge function clears any formatting and returns a minified version of whatever JSON value is provided as input. This commit simply uses the Reformat function to forcibly reformat the output. This will obviously become very slow for complex class hierarchies, as the function is called for every object. Fixes #11
1 parent 6642e2d commit c3537e2

6 files changed

Lines changed: 13 additions & 2 deletions

File tree

Flatten To JSON Object/Flatten To JSON Object.lvclass

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,16 @@
9696
<Property Name="NI.ClassItem.State" Type="Int">536576</Property>
9797
<Property Name="NI.LibItem.Scope" Type="Int">2</Property>
9898
</Item>
99+
<Item Name="Insert Type Name.vi" Type="VI" URL="../Insert Type Name.vi">
100+
<Property Name="NI.ClassItem.ConnectorPane" Type="Bin">&amp;Q#!!!!!!!)!"1!&amp;!!!-!%!!!@````]!!!!"!!%!!!#K!!!!"A!%!!!!&amp;%!Q`````QI]3F.04DYA&lt;X6U!!!31#%.5(*F&gt;(2Z)&amp;"S;7ZU0Q!31$$`````#62Z='5A4G&amp;N:1!31$$`````#4R+5U^/0C"J&lt;A"5!0!!$!!!!!!!!!!"!!!!!!!!!!)!!!!!!!-!"!-!!(A!!!!!!!!!!!!!!!!!!!E!!!!!!!!!!!!!!!!!!!!1!!!!!!!!!!!!!!!3!!!!%!!!!!!"!!5!!!!!</Property>
101+
<Property Name="NI.ClassItem.ExecutionSystem" Type="Int">-1</Property>
102+
<Property Name="NI.ClassItem.Flags" Type="Int">0</Property>
103+
<Property Name="NI.ClassItem.IsStaticMethod" Type="Bool">true</Property>
104+
<Property Name="NI.ClassItem.MethodScope" Type="UInt">2</Property>
105+
<Property Name="NI.ClassItem.Priority" Type="Int">1</Property>
106+
<Property Name="NI.ClassItem.State" Type="Int">1107821073</Property>
107+
<Property Name="NI.LibItem.Scope" Type="Int">2</Property>
108+
</Item>
99109
<Item Name="Handle Type Name.vi" Type="VI" URL="../Handle Type Name.vi">
100110
<Property Name="NI.ClassItem.ConnectorPane" Type="Bin">&amp;Q#!!!!!!!)!"1!&amp;!!!-!%!!!@````]!!!!"!!%!!!'U!!!!$1!-1#%'=X2B&gt;(6T!!!,1!-!"'.P:'5!!""!-0````]'=W^V=G.F!!!71&amp;!!!Q!!!!%!!AFF=H*P=C"P&gt;81!)E"Q!"Y!!!Z-97*73568)%^C;G6D&gt;!!)6(FQ:3"P&gt;81!!"*!-0````])3F.04C"P&gt;81!!%:!=!!?!!!A(E:M982U:7YA6']A3F.04C"09GJF9X1O&lt;(:D&lt;'&amp;T=Q!!'E:M982U:7YA6']A3F.04C"09GJF9X1A&lt;X6U!!!%!!!!)%"1!!-!!!!"!!)4:8*S&lt;X)A;7YA+'ZP)'6S=G^S+1!?1(!!(A!!$ERB9F:*26=A4W*K:7.U!!25?8"F!!!/1$$`````"%J44UY!!%2!=!!?!!!A(E:M982U:7YA6']A3F.04C"09GJF9X1O&lt;(:D&lt;'&amp;T=Q!!'5:M982U:7YA6']A3F.04C"09GJF9X1A;7Y!91$Q!!Q!!Q!%!!5!"A!(!!=!"Q!(!!A!#1!+!!M$!!"Y!!!.#!!!$1E!!!U+!!!.#Q!!!!!!!!!!!!!!!!!!!!!!!!I!!!!3!!!"%A!!!")!!!U!!!!-!!!!!!!!!!!!!!%!$!!!!!!</Property>
101111
<Property Name="NI.ClassItem.ExecutionSystem" Type="Int">-1</Property>
@@ -107,13 +117,13 @@
107117
<Property Name="NI.LibItem.Scope" Type="Int">2</Property>
108118
</Item>
109119
<Item Name="Handle Type.vi" Type="VI" URL="../Handle Type.vi">
110-
<Property Name="NI.ClassItem.ConnectorPane" Type="Bin">&amp;Q#!!!!!!!)!"1!&amp;!!!-!%!!!@````]!!!!"!!%!!!'3!!!!$!!-1#%'=X2B&gt;(6T!!!,1!-!"'.P:'5!!""!-0````]'=W^V=G.F!!!71&amp;!!!Q!!!!%!!AFF=H*P=C"P&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&gt;G.M98.T!!!:2GRB&gt;(2F&lt;C"5&lt;S"+5U^/)%^C;G6D&gt;#"J&lt;A"B!0!!$!!$!!1!"1!'!!1!"!!%!!=!#!!*!!I!#Q-!!(A!!!U)!!!!!!!!$1I!!!U,!!!!!!!!!!!!!!!!!!!1!!!!#A!!!"!!!!%3!!!!%A!!$1!!!!Q!!!!!!!!!!!!!!1!-!!!!!!</Property>
111121
<Property Name="NI.ClassItem.ExecutionSystem" Type="Int">-1</Property>
112122
<Property Name="NI.ClassItem.Flags" Type="Int">0</Property>
113123
<Property Name="NI.ClassItem.IsStaticMethod" Type="Bool">true</Property>
114124
<Property Name="NI.ClassItem.MethodScope" Type="UInt">2</Property>
115125
<Property Name="NI.ClassItem.Priority" Type="Int">1</Property>
116-
<Property Name="NI.ClassItem.State" Type="Int">1107821072</Property>
126+
<Property Name="NI.ClassItem.State" Type="Int">1342710288</Property>
117127
<Property Name="NI.LibItem.Scope" Type="Int">2</Property>
118128
</Item>
119129
<Item Name="JSON to LVObject.vi" Type="VI" URL="../JSON to LVObject.vi">
-1.11 KB
Binary file not shown.
17.9 KB
Binary file not shown.
28 Bytes
Binary file not shown.
Binary file not shown.

Tests/Pretty Print/Pretty Print.lvlib

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@
88
<Property Name="NI.LV.All.SourceOnly" Type="Bool">true</Property>
99
<Item Name="LVObject to JSON - Default - Pretty Print Disabled.vi" Type="VI" URL="../LVObject to JSON - Default - Pretty Print Disabled.vi"/>
1010
<Item Name="LVObject to JSON - False - Pretty Print Disabled.vi" Type="VI" URL="../LVObject to JSON - False - Pretty Print Disabled.vi"/>
11+
<Item Name="LVObject to JSON - Inline Type Name Handling - Output Is Pretty Printed.vi" Type="VI" URL="../LVObject to JSON - Inline Type Name Handling - Output Is Pretty Printed.vi"/>
1112
<Item Name="LVObject to JSON - True - Pretty Print Enabled.vi" Type="VI" URL="../LVObject to JSON - True - Pretty Print Enabled.vi"/>
1213
</Library>

0 commit comments

Comments
 (0)