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.
npm install dwml-to-json
var fs = require('fs');
var parser = require('dwml-to-json');
var xmlString = fs.readFileSync('path/to/dwml-file', 'utf8');
var parsedData = dwmlParser.parse(xmlString);
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
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.
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.