C # and Yaml parsing

Source: Internet
Author: User
Tags json to yaml

The official YAML website says Yaml is "a friendly data serialization standard that is available in all programming languages." Yaml Ain ' t Markup Language, like GNU, Yaml is a recursive name that says "no". The difference is that GNU says no to UNIX, and the object that Yaml says is XML.

YAML is not XML.


Why not XML? Because:

    • The readability of Yaml is good.
    • Yaml and scripting languages are very interactive.
    • YAML uses the data type that implements the language.
    • YAML has a consistent information model.
    • Yaml is easy to implement.

The above 5 is where XML is not enough. Also, YAML has the following advantages of XML:

    • Yaml can be processed based on streams;
    • Yaml has strong expressive ability and good extensibility.

In summary, Yaml tries to accomplish the task of XML in a way that is more agile than XML. See http://www.yaml.org for more content and specifications.

C # Implementation of Yamldotnet---YAML

Yaml already has a number of implementations, detailed implementation list see http://www.yaml.org/download.html. There is no. NET implementation in the list, actually. NET also has yamldotnet (http://aaubry.net/pages/yamldotnet.html) is a C # implementation of YAML. The Yaml file format focuses primarily on the concept of space indentation, which is used to indicate the hierarchical structure of the data rather than using an XML nested tag or a JSON curly brace ({}) and square brackets ([]), which in fact is a superset of the JSON, so when used, You may need to use JSON-style syntax to jump out of the space stream, and its founders describe it as providing humanized data serialization standards for all programming languages, in my experience, the emphasis is on humanization, this article human readable and editable config files The yamldotnet is briefly introduced with YAML (Http://blog.codeinside.eu/2015/02/09/yaml-dot-net ).

A list of the following examples on the official website of Yamldotnet can help you get started.

deserializing deserialization

The YAML document is converted to an object graph.

Serialization of serializing

Converts an object to its YAML representation.

Loading YAML Stream

Describes how to load YAML using a presentation model.

• During deserialization Validating

By manipulating the list of deserialized nodes, it is easy to add behaviors to the deserialization program. This example shows how to validate an object when they are deserialized.

Deserializing multiple documents

Explains how to load multiple YAML files from a stream.

Conversion of YAML to JSON and JSON to YAML, using Json.NET's JSON conversion YAML shows how to convert a Yaml file to JSON.

C # and Yaml parsing

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.