iron-serialize and iron-serialize-remote should be flexible, multi-use, serialization elements.
iron-serialize
iron-serialize should be a serialization/deserialization element. It should support all major data serialization formats, like XML, YAML, JSON, TOML, etc.
Example:
<!-- Note: 'yml' should also be considered YAML -->
<iron-serialize auto target="{{raw_obj}}" format="yaml" text="{{raw_yaml_text}}"></iron-serialize>
<!--
If raw_yaml_text is:
awesome: true
stuff:
- one
- two
- three
Then raw_obj should be:
{
awesome: true,
stuff: ["one", "two", "three"]
}
-->
If the target object or the text changes, the other should be updated to reflect the changes. (Only if there is auto attribute. Use generateChanges to change manually.)
Event for changing: change
iron-serialize-remote
iron-serialize-remote is just like iron-serialize, except it can serialize from a file (fetched with AJAX.)
Catch: it cannot update the file if the target object changes. However, you should be able to register a callback which might save the text somewhere else.
This would also pass on the auto attribute to its internal iron-serialize.
In fact, this would be a very rough implementation:
<iron-ajax auto url="{{file}}" handle-as="text" last-response="{{_t1}}"></iron-ajax>
<iron-serialize auto target="{{obj}}" format="json" text="[[_t1]]"></iron-serialize>
Description
iron-serialize
andiron-serialize-remote
should be flexible, multi-use, serialization elements.iron-serialize
iron-serialize
should be a serialization/deserialization element. It should support all major data serialization formats, like XML, YAML, JSON, TOML, etc.Example:
If the target object or the text changes, the other should be updated to reflect the changes. (Only if there is
auto
attribute. UsegenerateChanges
to change manually.) Event for changing:change
iron-serialize-remote
iron-serialize-remote
is just likeiron-serialize
, except it can serialize from a file (fetched with AJAX.) Catch: it cannot update the file if the target object changes. However, you should be able to register a callback which might save the text somewhere else.This would also pass on the
auto
attribute to its internaliron-serialize
.In fact, this would be a very rough implementation:
Event for changing:
change
Edit: Is
iron-serialize-remote
really needed?