json string to map

Home Forums Basic Erlang json string to map

This topic contains 1 reply, has 2 voices, and was last updated by  mpmiszczyk 11 months, 1 week ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #37293

    admin
    Keymaster

    Q:
    dao cuong (dao): Hi any one please tell me what is the best way to convert json string to map and map to json string

    A:

    Valerij Vasilkov: you can convert map to prop list and use known libraries for json conversations as a jsx or a jiffy
    jsx:encode(maps:to_list(Map)).
    but you must to be sure, that your keys and values in prop list – are binary | integer | float | true | false | null
    in another way you will have bag_arg in jsx

    #37365

    mpmiszczyk
    Member

    I would recommend using jsxn which is especially build for using maps
    https://github.com/talentdeficit/jsxn

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.