🔧 WSON (Web Simple Object Notation)
Nachrichtenbereich: 🔧 Programmierung
🔗 Quelle: dev.to
WSON is a new data serialization format designed to address the shortcomings of JSON and YAML.
Syntax Definition
1. Basic Structure
- The contents of a WSON file are enclosed in curly baces
{}
, which represent an object. - An object consists of key-value pairs.
- Keys and values are separated by either a colon (
:
) or an equals sign (=
).
2. Comments
- Comments begin with
//
or#
and are written on a single line. - Comments apply until the end of the line.
- Multi-line comments are not supported; for comments spanning multiple lines, add
//
or#
at the start of each line.
3. Object
- An object is enclosed in curly barces
{}
and contains key-value pairs. - You can use either
:
or=
between keys and values, and both symbols can be mixed within the same object - Each attribute is separated by a comma
,
. - Objects can be nested within other objects.
Example:
{
status: "success",
code = 200,
user = {
id: 123,
name: "John Doe"
}
}
4. Array
- Arrays are enclosed in square brackets
[]
, and elements are separated by commas,
. - Array elements can include objects, strings, numbers, and other data types.
- In WSON, arrays can be nested within objects, and arrays can contain other arrays or objects.
Example:
tasks: [
{
task_id: 1,
title: "Complete project report"
},
{
task_id: 2,
title: "Review team feedback"
}
]
5. Key-Value Pair
- Attribute names are strings and are followed by either
:
or=
, with the value placed immediately after. - Value types include strings, numbers, booleans, objects, and arrays.
- Strings are enclosed in double quotes
"
. - Numbers are used without quotes and can be integers or floating-point values.
Example:
name: "John Doe"
age = 25
6. Data Types
- String: Text enclosed in double quotes
"
.
"hello world"
- Number: An integer or floating-point value.
42
3.14
- Boolean: Uses
true
orfalse
valuse.
is_active = true
- Object: Key-value pairs enclosed in curly braces
{}
. - Array: A list of elements enclosed in square brackets
[]
.
7. Example Explanation
{
// Status code and message information
status: "success",
code: 200,
message: "Data retrieved successfully",
user = {
id = 123,
name: "John Doe",
email: "[email protected]",
age: 25 # User age
},
tasks: [
{
task_id: 1,
title: "Complete project report",
status: "in-progress",
due_date: "2024-10-15"
},
{
task_id: 2,
title: "Review team feedback",
status: "pending",
due_date: "2024-10-20"
}
]
}
🔧 WSON (Web Simple Object Notation)
📈 75.16 Punkte
🔧 Programmierung
🔧 JSON – JavaScript Object Notation
📈 26.79 Punkte
🔧 Programmierung
🔧 BigO (Big Oh) Notation
📈 18.53 Punkte
🔧 Programmierung
🔧 Understanding Big-O Notation
📈 18.53 Punkte
🔧 Programmierung
🔧 big 0 notation: laundry day
📈 18.53 Punkte
🔧 Programmierung
🍏 NCH Crescendo Music Notation Editor Pro 8.86
📈 18.53 Punkte
🍏 iOS / Mac OS
🔧 One-Byte: Last one: Big O Notation
📈 18.53 Punkte
🔧 Programmierung
🔧 Understanding Big O Notation in Python
📈 18.53 Punkte
🔧 Programmierung
🍏 MuseScore 4.0.0 - Music notation program.
📈 18.53 Punkte
🍏 iOS / Mac OS
🔧 Big O Notation: Speed Dating for Algorithms
📈 18.53 Punkte
🔧 Programmierung
🔧 Demystifying Big O Notation.
📈 18.53 Punkte
🔧 Programmierung
🔧 Big O Notation
📈 18.53 Punkte
🔧 Programmierung
🔧 Big O notation For dummies
📈 18.53 Punkte
🔧 Programmierung
💾 Crescendo Free Music Notation Editor
📈 18.53 Punkte
💾 Downloads