Share your advanced PureBasic knowledge/code with the community.
-
infratec
- Always Here
- Posts: 6874
- Joined: Sun Sep 07, 2008 12:45 pm
- Location: Germany
Post
by infratec »
Since it is easier to find I create an own topic here.
Code: Select all
EnableExplicit
Macro DebugStructure(variable_, structure_)
CompilerIf #PB_Compiler_Debugger
CompilerIf Not Defined(DebugStructure_JSON, #PB_Variable)
Define DebugStructure_JSON.i
CompilerEndIf
DebugStructure_JSON = CreateJSON(#PB_Any)
If DebugStructure_JSON
InsertJSONStructure(JSONValue(DebugStructure_JSON), @variable_, structure_)
Debug ComposeJSON(DebugStructure_JSON, #PB_JSON_PrettyPrint)
FreeJSON(DebugStructure_JSON)
EndIf
CompilerEndIf
EndMacro
Structure test
a.s
b.f
c.i
d.d
e.s
f.i
EndStructure
Define t.test
t\a = "Test"
t\b = 1.1
t\c = 3
t\d = 1.2345678
t\e = "blabla"
t\f = 2
DebugStructure(t, test)
Last edited by
infratec on Thu Oct 24, 2019 10:26 am, edited 1 time in total.
-
Kwai chang caine
- Always Here
- Posts: 5353
- Joined: Sun Nov 05, 2006 11:42 pm
- Location: Lyon - France
Post
by Kwai chang caine »
Yes, really good idea
Thanks for sharing
The happiness is a road...
Not a destination
-
davido
- Addict
- Posts: 1890
- Joined: Fri Nov 09, 2012 11:04 pm
- Location: Uttoxeter, UK
Post
by davido »
@infratec,
Thank you for your clever macro.
@Little John,
Thank you for placing the code in your JSON repository.
DE AA EB