Skip to content

romanr321/t2j

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 

Repository files navigation

t2j

This simple Erlang module converts Erlang terms to json.

Just drop the t2j.erl file in your src folder and you're good to go.

supports: atoms, booleans, null, strings, integers, floats, binary and arrays.

atom, string -> "string"

boolean, null -> true|false|null

int, float -> number

binary -> "string"

list -> array

tuple -> object

sample:

T = {"K",{{key, value},{key2,[{key3, true}, {key4, value4}, {key5, 5.333}]}}}.

t2j:t2jp(T).

output {"K":{"key":"value","key2":["key3":true,"key4":"value4","key5":5.333]}}

t2j:t2j(T).

output "{"K":{"key":"value","key2":["key3":true,"key4":"value4","key5":5.333]}}"

T2 = {"K",{{key, <<"value">>},{key2,["a",null,"c",4]}}}.

t2j:t2jp(T2).

output {"K":{"key":"value","key2":["a",null,"c",4]}}

About

convert tuples to json with ease

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages