jsx icon indicating copy to clipboard operation
jsx copied to clipboard

How i can Insert RAW data?

Open loguntsov opened this issue 6 years ago • 4 comments

Hello.

This is not issue but just question. Is there way to insert RAW data into encoded json ? As example: I have valid JSON-string: "{'a':1}" (it can be big string) i would want insert this string as JSON: {'key':{'a':1}}. I don't want decode/encode string twice, i just want insert this string to get resulted JSON as above. Is there way for this ?

I imagine this way like this: jsx:encode([{raw, key, "{'a':1}"}])

Thank you.

loguntsov avatar Mar 26 '18 08:03 loguntsov

you can use raw like: jsx:encode([{<<"key">>, {raw, "{\"a\":1}"}]) but it's not particularly efficient. it's equivalent to jsx:encode([{<<"key">>, jsx:decode("{\"a\":1}")]) more or less

talentdeficit avatar Mar 28 '18 16:03 talentdeficit

i don't like it

loguntsov avatar Mar 28 '18 18:03 loguntsov

Can i develop this logic jsx:encode([{raw, key, <<"{'a':1}">>}]) to make best way for my purpose ? Will this pull request be merged with upstream ?

loguntsov avatar Mar 29 '18 06:03 loguntsov

Is this still a valid concern? I seem to want something similar, but this issue went nowhere.

paulo-ferraz-oliveira avatar Sep 12 '20 01:09 paulo-ferraz-oliveira