Results 1 to 5 of 5

Thread: JSON to UDT

Threaded View

  1. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2006
    Posts
    372

    Re: JSON to UDT

    thanks for the info.
    i was hoping for a more elaborate solution than what i ended up with, but for my needs it works just fine. i gave up on coercion, and use a variant for everything.

    i use the script control to evaluate the json expression everytime it is needed. not the fastest way to do things, but very reliable and simple.


    Code:
    Public Function Eval(code As String, Optional prop As String) As Variant
     Dim x As Variant
    Dim Script2 As New ScriptControl
    Script2.Language = "JScript"
    
    x = (Script2.Eval(code & "['" & prop & "']  "))
    Eval = CStr(x) 
    End Function
    
    'example:
    msgbox Eval( "({a:1,b:2,c:3})", "a") 'displays "1"
    if my project gets more complex, i will be sure to check out the property bag...

    thanks again!
    Last edited by rnd me; Jan 11th, 2008 at 06:09 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width