tk-dwml-to-json

0.2.0 • Public • Published

dwml-to-json

A fork of thataustin/dwml-to-json.

Differences:

  • parses also series without end-valid-time
  • preserves timezones with Luxon
  • appends a type to series name, to distinguish eg. multiple temperature series (real & apparent)

Pass in a DWML string, get back a JS object.

This is a fairly naive approach to making DWML more approachable in JS.

Installation

npm install dwml-to-json

Example usage

var fs = require('fs');
var parser = require('dwml-to-json');
var xmlString = fs.readFileSync('path/to/dwml-file', 'utf8');
var parsedData = dwmlParser.parse(xmlString);

What does the JSON look like?

Look at the test file test/visual-example.js to see what the JSON looks like. That JSON is based on the DWML found in test/dwml.xml

Completeness

So far I've only tested precipitation and probability-of-precipitation as those were the only parameters I needed.

But you should be able to include any location-based parameters in your DWML document and recieve them in the JSON response.

Contributing

Please contribute. There were no dwml parsers when I wrote this, so I'd love it if we could all get behind one in the npm community.

Obviously you can fork this, etc, but the better this tool gets the more we all profit.

Readme

Keywords

Package Sidebar

Install

npm i tk-dwml-to-json

Weekly Downloads

3

Version

0.2.0

License

ISC

Unpacked Size

59 kB

Total Files

12

Last publish

Collaborators

  • tomaskafka