diff --git a/JSONItem_MTC.xojo_xml_code b/JSONItem_MTC.xojo_xml_code index 2ea3979..8cfad01 100644 --- a/JSONItem_MTC.xojo_xml_code +++ b/JSONItem_MTC.xojo_xml_code @@ -1,8 +1,8 @@ - + JSONItem_MTC - 0 + 1447604198 1 1 0 @@ -2267,6 +2267,24 @@ outMBs() As MemoryBlock, ByRef outIndex As Integer MemoryBlock + + ParseJSON + + 1 + + 134217984 + Shared Function ParseJSON(s As String) As Variant + dim j as new JSONItem_MTC( s ) + return j.ToNativeValue + End Function + + 134217984 + + 0 + 1 + s As String + Variant + Legal @@ -2642,6 +2660,70 @@ End Get + + ToNativeValue + + 1 + + 134217984 + Property ToNativeValue As Variant + + + 134217984 + ToNativeValue As Variant + 0 + 0 + + 134217984 + Set + + End Set + + + 134217984 + Get + if IsObject then + dim d as new Dictionary + + dim rawKeys() as variant = ObjectValues.Keys + dim values() as variant = ObjectValues.Values + + for i as integer = 0 to rawKeys.Ubound + dim name as string = KeyToName( rawKeys( i ) ) + dim value as variant = values( i ) + + if value isa JSONItem_MTC then + value = JSONItem_MTC( value ).ToNativeValue + end if + + d.Value( name ) = value + next + + return d + + elseif IsArray then + dim arr() as variant + redim arr( ArrayValues.Ubound ) + + for i as integer = 0 to ArrayValues.Ubound + dim value as variant = ArrayValues( i ) + if value isa JSONItem_MTC then + value = JSONItem_MTC( value ).ToNativeValue + end if + + arr( i ) = value + next + + return arr + + else + + return nil + + end if + End Get + + Compact