Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How i can Insert RAW data? #119

Open
loguntsov opened this issue Mar 26, 2018 · 4 comments
Open

How i can Insert RAW data? #119

loguntsov opened this issue Mar 26, 2018 · 4 comments

Comments

@loguntsov
Copy link

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.

@talentdeficit
Copy link
Owner

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

@loguntsov
Copy link
Author

i don't like it

@loguntsov
Copy link
Author

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 ?

@paulo-ferraz-oliveira
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants