Questions tagged [jiffy]

A JSON parser for Erlang

About

A JSON parser as a NLP Interchange Format (NIF). This is a complete rewrite of the work. A hand crafted state machine that does its best to be as quick and efficient as possible while not placing any constraints on the parsed JSON.

Links

13 questions
3
votes
2 answers

How to Convert a list of tuples into a Json string

I have a Erlang list of tuples as follows: [ {{"a"},[2],[{3,"b"},{4,"c"}],[5,"d"],[1,1],{e},["f"]} , {{"g"},[3],[{6,"h"},{7,"i"}],[{8,"j"}],[1,1,1],{k},["L"]} ] I wanted this list of tuples in this form: <<" [ …
abhishek ranjan
  • 612
  • 7
  • 23
3
votes
2 answers

Decode JSON property names to list strings instead of binary strings using Jiffy in Erlang

I have a tuple generated using jiffy library. For example : jiffy:decode(<<"{\"foo\":\"bar\"}">>). results in {[{<<"foo">>,<<"bar">>}]} I want <<"foo">> to be "foo" Is there a way for converting the <<"foo">> to "foo"? Basically I want to convert…
Mandeep Singh
  • 308
  • 2
  • 5
  • 18
3
votes
2 answers

How to convert Erlang object structure to Elixir Map?

I am using couchbeam to contact CouchDB from Elixir. But the lib gives me back old erlang object representation like {[{"foo", "bar"}]} and not elixir maps, this was due to the lib using jiffy:decode without return_maps, How do I convert this object…
2
votes
1 answer

Emoji Encoding and Decoding erlang from list to binary

I want this string to be parsed for VOIP Notification for iOS to binary string: "{\"data\":{\"text\":\"❤️\"}}" I expected the data printed on the Erlang shell to be: <<"{\"data\":{\"text\":\"❤️\"}}">> But when printed it…
2
votes
1 answer

Encoding Erlang Maps as JSON with Strings for parsing by Javascript?

I'm trying to take an Erlang map like #{"breakfast" => "leftovers"} and encode as a JSON map. I tried converting a list with jiffy for example (tunnel@127.0.0.1)27> binary_to_list(jiffy:encode(["alpha", "beta"]…
quantumpotato
  • 9,637
  • 14
  • 70
  • 146
2
votes
1 answer

erlang, convert list of tuples to json

I have a query in mnesia that returns a list of tuples like this: [{"str", 10}, {"str2", 20}] I want to convert it to json using jiffy but it seems jiffy:encode/1 can't do it. Is there anyway to solve my problem?!
Amin
  • 755
  • 6
  • 21
2
votes
1 answer

Rebar Jiffy dependency not available

I'm trying to add davisp/jiffy as a rebar dependency in Ejabberd so I can do some JSON parsing in my modules. I found this tutorial, where they add Jiffy as a dependency for a different project, but it didn't work. I tweaked it a little to match how…
sudo
  • 5,604
  • 5
  • 40
  • 78
1
vote
1 answer

Could not compile dependency :jiffy

I'm trying to run a mix server: ... Compiling c_src/decoder.c sh: 1: exec: cc: not found ===> Hook for compile failed! ** (Mix) Could not compile dependency :jiffy, "/home/user/.mix/rebar3 bare compile --paths…
Orange-Man
  • 150
  • 2
  • 10
1
vote
1 answer

How to install erlang modules from github?

I am new to Erlang and I need to install jiffy on my Mac. When I make / rebar compile, jeffy compiles without any errors. But I cant use it anywhere from shell. Do I have to copy .so files? How should I install erlang modules generally? I came…
Farshid Ashouri
  • 16,143
  • 7
  • 52
  • 66
1
vote
0 answers

Where is erlang dbg module gone on rebar3 build?

when running rebar3 compile, then ./_build/default/rel/api/bin/api console, then in erlang shell trying to use dbg I get. m(dbg). ** exception error: undefined function dbg:module_info/0 in function c:m/1 (c.erl, line 508) Any clue how to…
orotemo
  • 263
  • 1
  • 3
  • 8
1
vote
3 answers

How to read a key value after decoding json in erlang

Here is a short query In Erlang I parsed json using Ccode = jiffy:decode(<<"{\"foo\": \"bar\"}">>). it returns {[{<<"foo">>,<<"bar">>}]} Now target is to get value of 'foo' and it should return 'bar' any help is appreciated.
Gopal S Rathore
  • 9,885
  • 3
  • 30
  • 38
0
votes
1 answer

Include Jiffy in my Cowboy server

I've tried following Erlang: How to include libraries but the answers don't work for me. I cloned jiffy into deps/jiffy I'm using gmake run to run. My Makefile PROJECT = erlapp PROJECT_DESCRIPTION = New project PROJECT_VERSION = 0.1.0 DEPS =…
quantumpotato
  • 9,637
  • 14
  • 70
  • 146
0
votes
1 answer

Json (jiffy) support for ejabberd 2.1.11

I am using ejabberd 2.1.11 and willing to add support for json parsing using jiffy I did install erlang-jiffy and it works on erlang shell, but not within ejabberd modules. Is there any way we can configure it work with ejabberd?
Gopal S Rathore
  • 9,885
  • 3
  • 30
  • 38