可用于在OpenHarmony应用中实现YAML数据的解析与生成。支持Parse、Stringify及YAML Documents等核心功能,提供简洁API,适配DevEco Studio 4.1及OpenHarmony SDK API11。
| Files | Last commit | Last update |
|---|---|---|
| 2 years ago | ||
| 1 year ago | ||
| 2 years ago | ||
| 2 years ago | ||
| 2 years ago | ||
| 2 years ago | ||
| 2 years ago | ||
| 4 years ago | ||
| 2 years ago | ||
| 2 years ago | ||
| 5 months ago | ||
| 5 months ago | ||
| 1 year ago | ||
| 2 years ago | ||
| 2 years ago | ||
| 2 years ago | ||
| 2 years ago |
snakeyaml
Introduction
SnakeYAML is a library for parsing and generating YAML documents. It provides parse(), stringify(), and YAML.Document.

How to Install
ohpm install yaml@1.10.2
For details about the OpenHarmony ohpm environment configuration, see OpenHarmony HAR.
How to Use
YAML.stringify
YAML.stringify([true, false, 'maybe', null])
// `- true
// - false
// - maybe
// - null
// `
YAML.parse
YAML.parse('3.14159')
// 3.14159
Documents
const doc = new Document(['some', 'values', { balloons: 99 }])
doc.commentBefore = ' A commented document'
String(doc)
// # A commented document
//
// - some
// - values
// - balloons: 99
Available APIs
| Method | Parameter | Description |
|---|---|---|
| YAML.parse | str: string, options?: Options | parse |
| YAML.stringify | value: any, options?: Options | stringify |
| YAML.parseDocument | str: string, options?: Options | parseDocument |
| YAML.Document | options?: Options | Document |
Constraints
This project has been verified in the following version:
-
DevEco Studio: 4.1 Canary (4.1.3.317)
-
OpenHarmony SDK: API 11 (4.1.0.36)
Directory Structure
|---- snakeyaml
| |---- entry # Sample code
| |---- README.md # Readme
| |---- README_zh.md # Readme
How to Contribute
If you find any problem when using the project, submit an issue or a PR.
License
This project is licensed under ISC LICENSE.
Introduction
可用于在OpenHarmony应用中实现YAML数据的解析与生成。支持Parse、Stringify及YAML Documents等核心功能,提供简洁API,适配DevEco Studio 4.1及OpenHarmony SDK API11。
Customize your domain