Comments (6)
jsx:encode([{foo, <<"bar">>}])
will work but i'm hesitant to allow atoms in string positions because the atoms true
, false
and null
have special meaning as the second value of a 2-tuple. i like simple apis so i don't like exceptions like 'any atom EXCEPT true
, false
and null
will be converted to a json string'
while i agree it's obnoxious that jsx
can't just do the obvious thing here it's more obnoxious that people are going to generate json that they expect will be {"key": "true"}
but get {"key": true}
from jsx.
oh, i see. i didn't manage to reliably understand the last sentence, sorry. i believed things would be ok if we just excluded these three terminal cases from any further conversion.
from jsx.
i understand it seems stupid to not just make an exception for true
, false
and null
but it's simpler to explain 'all strings must be binaries' than 'all strings must be binaries or atoms unless they are the atoms true, false or null'. i think when dealing with api's you should always do the simplest thing possible
from jsx.
i see. another attempt and i'll retire :) as you're perfectly right on API.
it seems to me like a matter of wording. 'All binaries are converted to strings. All atoms except well-known true/false/null are converted to strings.' seems perfect to me.
my point is that the ability of encoding almost anything with least surprise and without friction is the killer feature of jsx. maybe an option to trigger said conversion?
thank you
from jsx.
i think most users don't really read documentation. they read just enough to think they know what they are doing and then go do it. i'm sorry but i don't think allowing atoms in positions where utf8 binaries are expected is worth it
from jsx.
np :)
from jsx.
Related Issues (20)
- jsx detect maps support may fail HOT 4
- Emoji Surrogate support HOT 4
- encode/decode datetime HOT 5
- How i can Insert RAW data? HOT 4
- Encode strings as strings HOT 1
- Parsing multiple json as stream HOT 3
- when can support json arrays
- Timestamp breaks encoding.
- Missing 2.10.0 tag HOT 1
- Configurable float formatting
- why?write HOT 1
- Dialyzer error for `with_tail`
- Release request HOT 8
- jsx_verify:config/0 type gone missing (dialyzer error) HOT 3
- Why return such a format? HOT 1
- Release request HOT 4
- Support the # as another way to comment strings
- Sensible default for tuple
- Documentation is broken on Hex for all releases
- B.C. dates convertes year to ****
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jsx.