modul / cereal Goto Github PK
View Code? Open in Web Editor NEWConvert between common serialization formats
License: MIT License
Convert between common serialization formats
License: MIT License
Make an installable Python tool out of this with defined requirements to all serialization modules (pyyaml so far).
It might be a good idea to explicitely set the input and/or output file format using a commandline option.
The output file name could then be derived from the input file name (replacing the file extension).
It should still be possible to supply an output file name and determine the file format from the file extensions of both, input and output, file names.
Multiple documents can be defined in a single YAML file. These can be translated into a list of objects in any output format.
For a first iteration just load all documents (yaml.safe_load_all
) and emit a single object if the input file only contains one document. Emit multiple documents as a list.
The output file name can be derived from the input file name and the selected output format (if #3 is implemented).
Either one must be present on the commandline: output file name or output file type.
This might not work for nested objects or lists.
Commandline flags must be used to choose between rows-first and columns-first serialization.
When converting from CSV rows-first would serialize to a list of rows at the root level containing each column as an object. This probably only works with a valid column header. Without a header, a row can only be serialized as a list.
Columns-first would serialize to an object at the root level containing where each field corresponds to a column. Each column would be serialized as a list. This also requires a valid column header.
When converting to CSV the root level object keys would be used as a column header.
A list at the root level would be converted into rows. For this to work, all list items must have the same structure. This might not be practical at all.
New commandline options:
--rows-first
or --by-row
--columns-first
or --by-column
--delimiter
if it cannot be detected automaticallyWhen selecting input/output formats is possible (see #3), it might be a good idea to only allow CSV as an input format.
Currently JSON is produced with no indentation. This should be a CLI option.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.