Git Product home page Git Product logo

Comments (3)

crdoconnor avatar crdoconnor commented on August 10, 2024 1
  1. There's no overlap. The feature (flow style) which make normal YAML a syntactic superset of JSON is simply turned off in StrictYAML and the parser will raise a FlowStyleDisallowed exception if you try to use it. The reasoning for this is in the FAQ. Basically it boils down to overcomplicated and (IMHO) unnecessary.

StrictYAML just parses as dicts, lists and scalar values though (strings by default, unless you use non-string validators), so it's perfectly valid to just parse a YAML document and dump it out as json if you want the same data in JSON format::

import strictyaml
import json

my_json = json.dumps(strictyaml.load(my_yaml_document).data)

YAML comments will obviously be dropped if you do this.

If you're parsing json, just use another json parser I guess.

from strictyaml.

crdoconnor avatar crdoconnor commented on August 10, 2024

Out of curiosity (and to help improve StrictYAML for others), can I ask what your use case is and how this affected your decision?

from strictyaml.

lofidevops avatar lofidevops commented on August 10, 2024

I'm planning on using StrictYAML to store and validate config values, but I'm aware that many other modules use JSON (including services written in other languages). I wanted to check if/how I could validate JSON data with StrictYAML and/or provide StrictYAML data to JSON consumers and (for no good reason) round-trip JSON data. This is all very abstract, I don't have any concrete implementations yet. Thanks for your response, it looks like it should be manageable. I'll be sure to make comments if I actually do anything interesting!

from strictyaml.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.