[erlang-questions] Decoding term_to_binary in javascript

Marc Worrell <>
Tue Nov 15 13:00:48 CET 2011


Hi Joe,

You might want to have a look at BERT:

http://bert-rpc.org/

- Marc


On 15 nov 2011, at 12:57, Joe Armstrong wrote:

> I'd like to send a term_to_binary encoded term to a web client and decode it in javascript.
> 
> If I could do this it would eliminate the impedance mismatch between server-side databases
> and client code in a browser. I want to totally eliminate conversions to and from JSON. Just send
> raw blobs containing term_to_binary encoded data and pluck what I want in the client.
> 
> I would not necessarily want to decode the entire blob, I might just want to extract a specific item
> So for example if In Erlang I created a blob by saying
> 
>       Blob = term_to_binary({thing,"foo","bar",["baz"]})
> 
> I'd like to send this to a browser and in Javascript say:
> 
>      var z = mylib_hd(my_lib_element(4,Blob))
> 
> Whereby z would be the javascript string "baz".
> 
> Has anybody implemented anything like this?
> 
> /Joe
> 
> 
> 
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions




More information about the erlang-questions mailing list