Showing posts with label creator. Show all posts
Showing posts with label creator. Show all posts

Thursday, 21 May 2015

Json creator in Erlang


creating json form data from erlang terms

input : list of tuple form of erlang term
output : string form of json 

erlang file: jsonGenerator.erl

how to use

createJson() -> 
Sample ={geonames, [
        { fcodeName, "capital of a political entity"},
        {toponymName, "Mexico City"},
        {countrycode, "MX"},
        {fcl, "P"},
        {fclName, "city, village,..."},
        {name, "Mexiko-Stadt"},
        {wikipedia, "en.wikipedia.org/wiki/Mexico_City"},
        {lng, -99.12766456604},
        {fcode, "PPLC"},
        {geonameId, 3530597},
        {lat, 19.428472427036},
        {population, 12294193}
]},
jsonGenerator:create_json(Sample).