11 ms·
Finally! I've had to live the JSON nightmare since I left Amazon. Some of the benefits over JSON: * Real date type * Real binary type - no need to base64 enc
by leef 10y ago
Finally! I've had to live the JSON nightmare since I left Amazon.
Some of the benefits over JSON:
* Real date type
* Real binary type - no need to base64 encode
* Real decimal type - invaluable when working with currency
* Annotations - You can tag an Ion field in a map with an annotation that says, e.g. its compression ("csv", "snappy") or its serialized type ('com.example.Foo').
* Text and binary format
* Symbol tables - this is like automated jsonpack.
* It's self-describing - meaning, unlike Avro, you don't need the schema ahead of time to read or write the data.
- conradev 10y agoSounds a lot like Apple's property list format, which shares almost everything you listed in common, except for annotations and symbol tables. Its binary format was introduced in 2002! Edit: Property lists only support integers up to 128 bits in size and double-precision floating point numbers. On top of those, Ion also supports infinite precision decimals.
- jonhohle 10y agoLike Property Lists the binary format is TLV encoded as well. Ion has a more compact binary representation for the same data and additional types and metadata. Also, IIRC, Plist types are limited to 32-bit lengths for all data types. The binary Ion representation has no such restriction (though in practice sizes are often limited by the language implementation).
- JonathonW 10y agoPlists are nifty, but the text format's XML-based, which makes it too complex and too verbose to be a general-purpose alternative to something like JSON. (plutil "supports" a json format, but it's not capable of expressing the complete feature set of the XML or binary formats.)
- pjmlp 10y agoI don't get this gripe with XML, it is meant to be used by tools not to be written by hand. Where is the XPath and XQuery for JSON? Do people really think that manually iterating over the whole JSON document to find the data or writing yet another parser, is better?
- kyllo 10y agoReal decimal type - invaluable when working with currency What does JavaScript do with this though, just cast it to a float?
- troyk 10y agomove the decimal and use an int (cents in US). It still blows me away that javascript has become so popular on the server without 64bit int types.
- justin_oaks 10y agoDo you really need those extra 11 bits? Javascript numbers accurately represent integers up to 2^53 - 1. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- Cshelton 10y agoI just did some ownership percentage stuff where it's not uncommon to go 16 decimal places out...working with JavaScript on this was a pain. Never thought I'd care about that .00000000000001 difference hah...
- tlarkworthy 10y agofloating point works best near 0, most of the numbers it can represent lie near 0 (negative exponent is a number less than 1).
- snuxoll 10y agoUntil you need to deal with decimals instead of floats, then you are going to hate yourself because you have to pull in some third party library because the language treats every single number as a float (and floating point errors are a lot more common than most people think even when they are adding together simple numbers).
- nikolay 10y agoOkay, but they did a really poor job marketing it in this release. Plus, if it's used within Amazon, why it's Java-only so far?
- makoz 10y agoAmazon's mainly a Java shop, not sure if that helps you.
- nikolay 10y agoNot really the case - a lot of major projects (like boto and AWS CLI) are in Python.
- majewsky 10y agoThese are only client-side interfaces. The server-side is usually much larger.
- nikolay 10y agoTrue, but my point was that there's enough talent at Amazon, working on SDKs, and others, and there are precedents where even more complex projects such as JMESPath have wide support [0]. [0]: http://jmespath.org/libraries.html http://jmespath.org/libraries.html
- deleted 10y ago[deleted]
- umanwizard 10y agoI'm sure there are ion bindings for every language in common use at Amazon. But a huge percentage of Amazon code is Java, so presumably this one was the best maintained and documented.
- sswezey 10y agoI doubt it, when I was there Ion was only used by only a handful of Java teams doing backend work. It was also horribly documented and supported at the time (3.5 years ago).
- hartror 10y agoDoes it support comments?
- leef 10y agoYes - http://amznlabs.github.io/ion-docs/spec.html http://amznlabs.github.io/ion-docs/spec.html
- Pamar 10y ago> * Real decimal type - invaluable when working with currency I believe that the proper way to handle money is to use Integer values plus a pre-defined precision.
- efaref 10y agoYou could have used CBOR for many of those things (http://cbor.io/ http://cbor.io/).
- dgreensp 10y agoThanks for the link!