Results 1 to 10 of 11

Thread: Serializing Data for the Web Interface with JSON

Hybrid View

  1. #1
    Join Date
    Jul 2010
    Posts
    28

    Default Serializing Data for the Web Interface with JSON

    So instead of continuing to derail another post, I decided to start a new one.

    How would one go about serializing data inside Girder for a web interface to take advantage of?

  2. #2
    Join Date
    Jun 2008
    Posts
    1,026

    Default

    there is a lua json library http://json.luaforge.net/

  3. #3
    Join Date
    Jan 1998
    Location
    Jupiter, FL
    Posts
    13,541

    Default

    It's included with Girder.
    Ron
    No support through PM

  4. #4
    Join Date
    Jun 2008
    Posts
    1,026

    Default

    i guess i should have known that.

    there is a new release on the website and indicates some performance improvements.

  5. #5
    Join Date
    Jul 2010
    Posts
    28

    Default

    Very cool.

    So to use it, inside Girder I would do something like:

    Code:
    myJSONString = json.encode( {'foo', 'bar'} )
    Then, from the interface:

    Code:
    $.get("ajaxreq.lhtml?Data=myJSONString",null, function(data){
    		// do something with the data
    });
    Is that basically how it works?

  6. #6
    Join Date
    Jan 1998
    Location
    Jupiter, FL
    Posts
    13,541

    Default

    Yep.

    Code:
    local json = require('json.json')
    local x = json.encode( { 'asdf','asdf' } )
    webserver:print(x)
    Ron
    No support through 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
  •