msgpack scala : How to pack a json string

325 views
Skip to first unread message

Bathily Didier

unread,
Apr 8, 2014, 1:28:08 PM4/8/14
to msg...@googlegroups.com
Hi, 

I'm new to msg pack. I'm trying to pack a json string by my server (playframework) and get it as a json by my client (as3). 

Someone can help me on this please?

Thank you

Didier

Tsuyoshi OZAWA

unread,
Apr 9, 2014, 6:54:30 AM4/9/14
to msg...@googlegroups.com
Hi Bathily,

How about trying msgpack-scala?
This is a quickstart page for msgpack-scala.
http://wiki.msgpack.org/display/MSGPACK/QuickStart+for+Scala

Thanks,
- Tsuyoshi

Bathily Didier

unread,
Apr 9, 2014, 7:32:12 AM4/9/14
to msg...@googlegroups.com
Yes Tsuyoshi i'm using msgpack-scala but i didn't find a way to pack a json. mspack-scala serialize an object. Did you already use msgpack-scala? 

Bathily Didier

unread,
Apr 9, 2014, 8:15:47 AM4/9/14
to msg...@googlegroups.com
I think my question is stupid. msgpack is a serialization protocol, so I need to define a Template for play framework json api

Tsuyoshi OZAWA

unread,
Apr 9, 2014, 6:36:06 PM4/9/14
to msg...@googlegroups.com
Let me clarify what you'd like to do.
Do you want to transform a JSON object into a msgpack object on server?

Thanks,
- Tsuyoshi

Didier Bathily

unread,
Apr 10, 2014, 2:38:13 AM4/10/14
to msg...@googlegroups.com
I have an object of type play.api.data.json.JsValue (playframework 2 json API) which is a JSON and I wan't to pack it with msgpack and send it through the network. 
My question is : can I do this without creating some Templates for JsValue?  There is maybe a way to pack a json by its String value?
--
You received this message because you are subscribed to a topic in the Google Groups "MessagePack Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/msgpack/nH4PL8k7x-U/unsubscribe.
To unsubscribe from this group and all its topics, send an email to msgpack+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tsuyoshi OZAWA

unread,
Apr 10, 2014, 4:15:20 AM4/10/14
to msg...@googlegroups.com
> There is maybe a way to pack a json by its String value?

One straight way to do it is encoding by BASE64.
One concern in that case is performance - you need to deselialize JSON and BASE64 and msgpack objects.

If you have fixed schema, it is an alternative method translating JsValue into Scala object
and packing the scala object as msgpack.

I hope one of these methods helps you.

Thanks
- Tsuyoshi

Didier Bathily

unread,
Apr 10, 2014, 8:51:36 AM4/10/14
to msg...@googlegroups.com
Thank you very much Tsuyoshi, you gave me the answer. Performance is not a problem, so I will use the BASE64 trick and I don’t have a fixed schema.
Reply all
Reply to author
Forward
0 new messages