Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 4 of 4
  1. #1
    Senior Member erland's Avatar
    Join Date
    Dec 2005
    Location
    Sweden
    Posts
    10,313

    Sending binary data in JSON commands ?

    What's the best way to send binary data in a JSON command parameter ?

    Do I have to base64 encode it or is there some better way ?
    In that case, is there some base64 encoding function available in the lua libraries bundled with Squeezeplay ?

    I'm making the call from a lua applet, so I have to be able to encode it using lua.

    I want the binary information to be transfered from the applet running in Squeezeplay to a plugin in SBS.
    Erland Isaksson (My homepage)
    (Developer of many plugins/applets (both free and commercial).
    If you like to encourage future presence on this forum and/or third party plugin/applet development, consider purchasing some plugins)
    You may also want to try my Android apps Squeeze Display and RSS Photo Show
    Interested in the future of music streaming ? ickStream - A world of music at your fingertips.

  2. #2
    Senior Member flattermann's Avatar
    Join Date
    Oct 2009
    Location
    Dortmund, Germany
    Posts
    774
    Quote Originally Posted by erland View Post
    What's the best way to send binary data in a JSON command parameter ?

    Do I have to base64 encode it or is there some better way ?
    In that case, is there some base64 encoding function available in the lua libraries bundled with Squeezeplay ?

    I'm making the call from a lua applet, so I have to be able to encode it using lua.

    I want the binary information to be transfered from the applet running in Squeezeplay to a plugin in SBS.
    Binary data is not supported in JSON, so, yes, I think you will need to base64 encode the data.

    There are some LUA base64 libs, e.g.
    http://lua-users.org/wiki/BaseSixtyFour (LGPL)

    But I've not used them on my own, so I can't tell you if they work as expected.
    Christian

    Home of SqueezeCommander - The SqueezeBox Remote Control App for Android

  3. #3
    Senior Member
    Join Date
    Apr 2005
    Posts
    6,932

    Sending binary data in JSON commands ?

    There's already a base64 support in the lua mime library. I use it all the
    time...

    >> I want the binary information to be transfered from the applet running
    >> in Squeezeplay to a plugin in SBS.

    >
    > Binary data is not supported in JSON, so, yes, I think you will need to
    > base64 encode the data.
    >
    > There are some LUA base64 libs, e.g.
    > http://lua-users.org/wiki/BaseSixtyFour (LGPL)
    >
    > But I've not used them on my own, so I can't tell you if they work as
    > expected.




  4. #4
    Senior Member erland's Avatar
    Join Date
    Dec 2005
    Location
    Sweden
    Posts
    10,313
    Quote Originally Posted by Triode View Post
    There's already a base64 support in the lua mime library. I use it all the time...
    Thanks, I knew it had to be in there somewhere.
    Erland Isaksson (My homepage)
    (Developer of many plugins/applets (both free and commercial).
    If you like to encourage future presence on this forum and/or third party plugin/applet development, consider purchasing some plugins)
    You may also want to try my Android apps Squeeze Display and RSS Photo Show
    Interested in the future of music streaming ? ickStream - A world of music at your fingertips.

Posting Permissions

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