lang-conversion
install
npm install --save @hydrant/lang-conversion
usage
deserialize (import)
import { deserialize } from '@hydrant/lang-conversion';
const content = '{ "foo": "bar" }';
const result = await deserialize({ content, deserializer: 'json' });
You can also pass in filename
instead of setting deserializer
.
serialize (export)
import { serialize } from '@hydrant/lang-conversion';
const entries = [{ id: 'foo', value: 'bar' }];
const meta = { version: 3, date: '9.9.2020' };
const result = await serialize({ entries, meta, serializer: 'xml' });
You can also pass in filename
instead of setting serializer
.