alavrik / erlson

Erlang Simple Object Notation - dynamic name-value dictionary data type and syntax for Erlang
MIT License
81 stars 17 forks source link

Add support for bare JSON arrays #4

Closed jeremey closed 12 years ago

jeremey commented 12 years ago

erlson doesn't currently support encoding or decoding bare JSON arrays. It would be nice to use erlson exclusively and not bounce between it and mochijson2. This change implements support for bare JSON arrays and doesn't break anything I've tested.

alavrik commented 12 years ago

I like the idea and I think it will be useful. However your change violates interface contracts.

The interfaces explicitly say: converting one Erlson dict to/from one JSON object. In addition to -specs, there are runtime checks verifying that.

In order to do this in a clean way, you would need to add 4 new functions: list_from_json_array, list_to_json_array, list_from_json_term and list_to_json_term. Their implementation is trivial and clean.

alavrik commented 12 years ago

this functionality was submitted and merged as a new separate pull request