|
|
| Author |
Message |
< Erlang ~ [<<"{'addmenow',123,'abc',456}">>] JS |
| sexmith |
Posted: Thu Jan 03, 2008 12:57 am |
|
|
|
Joined: 03 Jan 2008
Posts: 5
Location: Ohio USA
|
[<<"{'addmenow',123,'abc',456}">>] JSON binary_to_term
I am playing around with Tony Garnock-Jones (LShift Ltd.) JSON-RPC service
3 days after receiving Joe Armstong's Erlang book.
I am capturing the Client Sent JSON message as a variable.
Avariable = [<<"{'addmenow',123,'abc',456}">>]
My problem is I can not parse this. Even using binary_to_term fails.
Within erl I can interactively input [<<"{'addmenow',123,'abc',456}">>]
I can even bound it to Avariable via:
Avariable = [<<"{'addmenow',123,'abc',456}">>].
And at the prompt type A. it returns
[<<"{'addmenow',123,'abc',456}">>]
What is this thing? Is it a single atom within a list?
How do I remove the << >> yielding a string that lists:sublist
could deal with?
Can an atom be parsed in Erlang?
Robert Sexmith
New to Erlang, Confused and missing my Perl regex |
|
|
| Back to top |
|
| Mazen |
Posted: Thu Jan 03, 2008 10:47 am |
|
|
|
User
Joined: 20 Jul 2006
Posts: 164
Location: London
|
Hello,
First of all the binary is a string (a term, but more specifically a string ) so use binary_to_string. Also it is in a list so use hd() or [H|_] = L. to get the binary.
Good luck,
/M |
|
|
| Back to top |
|
| sexmith |
Posted: Fri Jan 04, 2008 4:11 am |
|
|
|
Joined: 03 Jan 2008
Posts: 5
Location: Ohio USA
|
Thanks Mazen for putting me on the right path
[<<"{'addmenow',123,'abc',456}">>]
List containing a binary (which is a string (which is a list of 8byte characters)
In parsing it (with 4 days knowledge) I used the following:
binary_to_list
String:strip
string:tokens
In building a binary from strings and variables I used the following:
lists:append
list_to_binary |
|
|
| Back to top |
|
| wuji |
Posted: Fri Aug 24, 2012 7:44 am |
|
|
|
User
Joined: 10 Aug 2012
Posts: 654
|
they do the bariatric surgery and lose weight and then then knockoff designer *beep* then gain it again ... They went to all the
and suffering and things didn't change that much. It's easy easy cheap authentic jordans easy to imagine they would be depressed."Jackson Jr. and others
bipolar disorder are most likely to do better in his his [h4]buy real jordans[/h4] his recovery with the support of family and friends, according
Galykner.Already, former Rep. Patrick Kennedy has expressed an interest in in cheap replica *beep* in visiting Jackson, according to ABC's affiliate in Chicago, WLS-TV. |
|
|
| Back to top |
|
| dongdongwu |
Posted: Thu Sep 20, 2012 2:14 am |
|
|
|
User
Joined: 19 Sep 2012
Posts: 236
|
His good friend Diane said: "Christian Louboutin Men Shoes was a magician, he make shoes is immediately put his female people with legs and advantage. He understands women wanted to do and can make them into beautiful Cinderella." Madonna often in its concert wearing Christian louboutin high heels , and some famous superstar like Angelina jolie, mariah Carey, beyonce Knowles, the famous Japanese singer YaYouMei Hamasaki helps Christian Louboutin Men Shoes set up its powerful position. The youngest customers will count Tom cruise's daughter sully cruz. Louboutin made for only a pair of handmade Christian Louboutin high heel Shoes! Want to be more fashion? Put on Christian Louboutin Outlet !
Candy colors of the chalaza high-heeled shoes with lolita type allure, set full finely gem blue "neon shoes" is to need to use "sexy" to describe. Each pair are worth careful appreciation of lithe and graceful fairy ludaoli, what kind of most let you move?Christian Louboutin Men Shoes that one brush red is always cannot resist the temptation, Christian Louboutin men outlet continue to use the days of high 8cm above slender heel proclaim the sexy and luxuriant. The bowknot on black pointed high-heeled shoes with sharp rivet concomitant, wild python met enchanting color printing grain, It is that pairs of high-heeled shoes lets Carrie more feminine flavour. Like Christian Louboutin for men her word. |
|
|
| Back to top |
|
|
|
All times are GMT
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|
|