...
This commit is contained in:
78
aiprompts/herolib_advanced/openrpcexample.json
Normal file
78
aiprompts/herolib_advanced/openrpcexample.json
Normal file
@@ -0,0 +1,78 @@
|
||||
{
|
||||
"openrpc": "1.0.0-rc1",
|
||||
"info": {
|
||||
"title": "Simple RPC overview",
|
||||
"version": "2.0.0"
|
||||
},
|
||||
"methods": [
|
||||
{
|
||||
"name": "get_versions",
|
||||
"summary": "List API versions",
|
||||
"params": [],
|
||||
"result": {
|
||||
"name": "get_version_result",
|
||||
"schema": {
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"examples": [
|
||||
{
|
||||
"name": "v2",
|
||||
"summary": "its a v2 example pairing!",
|
||||
"description": "aight so this is how it works. You foo the bar then you baz the razmataz",
|
||||
"params": [],
|
||||
"result": {
|
||||
"name": "versionsExample",
|
||||
"value": {
|
||||
"versions": [
|
||||
{
|
||||
"status": "CURRENT",
|
||||
"updated": "2011-01-21T11:33:21Z",
|
||||
"id": "v2.0",
|
||||
"urls": [
|
||||
{
|
||||
"href": "http://127.0.0.1:8774/v2/",
|
||||
"rel": "self"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"status": "EXPERIMENTAL",
|
||||
"updated": "2013-07-23T11:33:21Z",
|
||||
"id": "v3.0",
|
||||
"urls": [
|
||||
{
|
||||
"href": "http://127.0.0.1:8774/v3/",
|
||||
"rel": "self"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "get_version_details",
|
||||
"summary": "Show API version details",
|
||||
"params": [],
|
||||
"result": {
|
||||
"name": "foo",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"examples": [
|
||||
{
|
||||
"name": "stringifiedVersionsExample",
|
||||
"params": [],
|
||||
"result": {
|
||||
"name": "bliggityblaow",
|
||||
"value": "{\n \"versions\": [\n {\n \"status\": \"CURRENT\",\n \"updated\": \"2011-01-21T11:33:21Z\",\n \"id\": \"v2.0\",\n \"urls\": [\n {\n \"href\": \"http://127.0.0.1:8774/v2/\",\n \"rel\": \"self\"\n }\n ]\n },\n {\n \"status\": \"EXPERIMENTAL\",\n \"updated\": \"2013-07-23T11:33:21Z\",\n \"id\": \"v3.0\",\n \"urls\": [\n {\n \"href\": \"http://127.0.0.1:8774/v3/\",\n \"rel\": \"self\"\n }\n ]\n }\n ]\n}\n"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
212
aiprompts/v_core/json/cjson.md
Normal file
212
aiprompts/v_core/json/cjson.md
Normal file
@@ -0,0 +1,212 @@
|
||||
# module cjson
|
||||
|
||||
|
||||
## Contents
|
||||
- [create_array](#create_array)
|
||||
- [create_bool](#create_bool)
|
||||
- [create_false](#create_false)
|
||||
- [create_null](#create_null)
|
||||
- [create_number](#create_number)
|
||||
- [create_object](#create_object)
|
||||
- [create_raw](#create_raw)
|
||||
- [create_string](#create_string)
|
||||
- [create_true](#create_true)
|
||||
- [delete](#delete)
|
||||
- [version](#version)
|
||||
- [Node](#Node)
|
||||
- [add_item_to_object](#add_item_to_object)
|
||||
- [add_item_to_array](#add_item_to_array)
|
||||
- [print](#print)
|
||||
- [print_unformatted](#print_unformatted)
|
||||
- [str](#str)
|
||||
- [CJsonType](#CJsonType)
|
||||
- [C.cJSON](#C.cJSON)
|
||||
|
||||
## create_array
|
||||
```v
|
||||
fn create_array() &Node
|
||||
```
|
||||
|
||||
create_array creates a new JSON array item. Use .add_item_to_array(value) calls, to add items to it later.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## create_bool
|
||||
```v
|
||||
fn create_bool(val bool) &Node
|
||||
```
|
||||
|
||||
create_bool creates a new JSON boolean item.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## create_false
|
||||
```v
|
||||
fn create_false() &Node
|
||||
```
|
||||
|
||||
create_false creates a new JSON boolean item, with value `false`.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## create_null
|
||||
```v
|
||||
fn create_null() &Node
|
||||
```
|
||||
|
||||
create_null creates a new JSON NULL item, with the value `null`. It symbolises a missing value for a given key in an object.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## create_number
|
||||
```v
|
||||
fn create_number(val f64) &Node
|
||||
```
|
||||
|
||||
create_number creates a new JSON number item.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## create_object
|
||||
```v
|
||||
fn create_object() &Node
|
||||
```
|
||||
|
||||
create_object creates a new JSON object/map item. Use .add_item_to_object(key, value) calls, to add other items to it later.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## create_raw
|
||||
```v
|
||||
fn create_raw(const_val string) &Node
|
||||
```
|
||||
|
||||
create_raw creates a new JSON RAW string item.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## create_string
|
||||
```v
|
||||
fn create_string(val string) &Node
|
||||
```
|
||||
|
||||
create_string creates a new JSON string item.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## create_true
|
||||
```v
|
||||
fn create_true() &Node
|
||||
```
|
||||
|
||||
create_true creates a new JSON boolean item, with value `true`.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## delete
|
||||
```v
|
||||
fn delete(node &Node)
|
||||
```
|
||||
|
||||
delete removes the given node from memory. NB: DO NOT USE that node, after you have called `unsafe { delete(node) }` !
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## version
|
||||
```v
|
||||
fn version() string
|
||||
```
|
||||
|
||||
version returns the version of cJSON as a string.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## Node
|
||||
```v
|
||||
type Node = C.cJSON
|
||||
```
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## add_item_to_object
|
||||
```v
|
||||
fn (mut obj Node) add_item_to_object(key string, item &Node)
|
||||
```
|
||||
|
||||
add_item_to_array adds the given item to the object, under the given `key`.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## add_item_to_array
|
||||
```v
|
||||
fn (mut obj Node) add_item_to_array(item &Node)
|
||||
```
|
||||
|
||||
add_item_to_array append the given item to the object.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## print
|
||||
```v
|
||||
fn (mut obj Node) print() string
|
||||
```
|
||||
|
||||
print serialises the node to a string, formatting its structure, so the resulting string is more prettier/human readable.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## print_unformatted
|
||||
```v
|
||||
fn (mut obj Node) print_unformatted() string
|
||||
```
|
||||
|
||||
print serialises the node to a string, without formatting its structure, so the resulting string is shorter/cheaper to transmit.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## str
|
||||
```v
|
||||
fn (mut obj Node) str() string
|
||||
```
|
||||
|
||||
str returns the unformatted serialisation to string of the given Node.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## CJsonType
|
||||
```v
|
||||
enum CJsonType {
|
||||
t_false
|
||||
t_true
|
||||
t_null
|
||||
t_number
|
||||
t_string
|
||||
t_array
|
||||
t_object
|
||||
t_raw
|
||||
}
|
||||
```
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## C.cJSON
|
||||
```v
|
||||
struct C.cJSON {
|
||||
pub:
|
||||
next &C.cJSON // next/prev allow you to walk array/object chains. Alternatively, use GetArraySize/GetArrayItem/GetObjectItem
|
||||
prev &C.cJSON
|
||||
child &C.cJSON // An array or object item will have a child pointer pointing to a chain of the items in the array/object
|
||||
|
||||
type CJsonType // The type of the item, as above
|
||||
|
||||
valueint int // writing to valueint is DEPRECATED, use cJSON_SetNumberValue instead
|
||||
valuedouble f64 // The item's number, if type==cJSON_Number
|
||||
valuestring &char // The item's string, if type==cJSON_String and type == cJSON_Raw
|
||||
// @string &char // The item's name string, if this item is the child of, or is in the list of subitems of an object
|
||||
// TODO: `@string &char` from above does not work. It should be fixed, at least inside `struct C.`.
|
||||
}
|
||||
```
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
#### Powered by vdoc. Generated on: 2 Sep 2025 07:37:38
|
||||
48
aiprompts/v_core/json/json.md
Normal file
48
aiprompts/v_core/json/json.md
Normal file
@@ -0,0 +1,48 @@
|
||||
# module json
|
||||
|
||||
|
||||
## Contents
|
||||
- [decode](#decode)
|
||||
- [encode](#encode)
|
||||
- [encode_pretty](#encode_pretty)
|
||||
- [C.cJSON](#C.cJSON)
|
||||
|
||||
## decode
|
||||
```v
|
||||
fn decode(typ voidptr, s string) !voidptr
|
||||
```
|
||||
|
||||
decode tries to decode the provided JSON string, into a V structure. If it can not do that, it returns an error describing the reason for the parsing failure.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## encode
|
||||
```v
|
||||
fn encode(x voidptr) string
|
||||
```
|
||||
|
||||
encode serialises the provided V value as a JSON string, optimised for shortness.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## encode_pretty
|
||||
```v
|
||||
fn encode_pretty(x voidptr) string
|
||||
```
|
||||
|
||||
encode_pretty serialises the provided V value as a JSON string, in a formatted way, optimised for viewing by humans.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## C.cJSON
|
||||
```v
|
||||
struct C.cJSON {
|
||||
valueint int
|
||||
valuedouble f64
|
||||
valuestring &char
|
||||
}
|
||||
```
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
#### Powered by vdoc. Generated on: 2 Sep 2025 07:37:38
|
||||
100
aiprompts/v_core/json2/decoder2.md
Normal file
100
aiprompts/v_core/json2/decoder2.md
Normal file
@@ -0,0 +1,100 @@
|
||||
# module decoder2
|
||||
|
||||
|
||||
## Contents
|
||||
- [decode](#decode)
|
||||
- [decode_array](#decode_array)
|
||||
- [BooleanDecoder](#BooleanDecoder)
|
||||
- [NullDecoder](#NullDecoder)
|
||||
- [NumberDecoder](#NumberDecoder)
|
||||
- [StringDecoder](#StringDecoder)
|
||||
- [JsonDecodeError](#JsonDecodeError)
|
||||
|
||||
## decode
|
||||
```v
|
||||
fn decode[T](val string) !T
|
||||
```
|
||||
|
||||
decode decodes a JSON string into a specified type.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## decode_array
|
||||
```v
|
||||
fn decode_array[T](src string) !T
|
||||
```
|
||||
|
||||
decode_array is a generic function that decodes a JSON string into the array target type.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## BooleanDecoder
|
||||
```v
|
||||
interface BooleanDecoder {
|
||||
mut:
|
||||
// called with converted bool
|
||||
// already checked so no error needed
|
||||
from_json_boolean(boolean_value bool)
|
||||
}
|
||||
```
|
||||
|
||||
implements decoding json true/false
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## NullDecoder
|
||||
```v
|
||||
interface NullDecoder {
|
||||
mut:
|
||||
// only has one value
|
||||
// already checked so no error needed
|
||||
from_json_null()
|
||||
}
|
||||
```
|
||||
|
||||
implements decoding json null
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## NumberDecoder
|
||||
```v
|
||||
interface NumberDecoder {
|
||||
mut:
|
||||
// called with raw string of number e.g. '-1.234e23'
|
||||
from_json_number(raw_number string) !
|
||||
}
|
||||
```
|
||||
|
||||
implements decoding json numbers, e.g. -1.234e23
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## StringDecoder
|
||||
```v
|
||||
interface StringDecoder {
|
||||
mut:
|
||||
// called with raw string (minus apostrophes) e.g. 'hello, \u2164!'
|
||||
from_json_string(raw_string string) !
|
||||
}
|
||||
```
|
||||
|
||||
implements decoding json strings, e.g. "hello, \u2164!"
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## JsonDecodeError
|
||||
```v
|
||||
struct JsonDecodeError {
|
||||
Error
|
||||
context string
|
||||
pub:
|
||||
message string
|
||||
|
||||
line int
|
||||
character int
|
||||
}
|
||||
```
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
#### Powered by vdoc. Generated on: 2 Sep 2025 07:37:54
|
||||
63
aiprompts/v_core/json2/strict.md
Normal file
63
aiprompts/v_core/json2/strict.md
Normal file
@@ -0,0 +1,63 @@
|
||||
# module strict
|
||||
|
||||
|
||||
## Contents
|
||||
- [get_keys_from_json](#get_keys_from_json)
|
||||
- [strict_check](#strict_check)
|
||||
- [KeyType](#KeyType)
|
||||
- [KeyStruct](#KeyStruct)
|
||||
- [StructCheckResult](#StructCheckResult)
|
||||
|
||||
## get_keys_from_json
|
||||
```v
|
||||
fn get_keys_from_json(tokens []string) []KeyStruct
|
||||
```
|
||||
|
||||
get_keys_from_json .
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## strict_check
|
||||
```v
|
||||
fn strict_check[T](json_data string) StructCheckResult
|
||||
```
|
||||
|
||||
strict_check .
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## KeyType
|
||||
```v
|
||||
enum KeyType {
|
||||
literal
|
||||
map
|
||||
array
|
||||
}
|
||||
```
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## KeyStruct
|
||||
```v
|
||||
struct KeyStruct {
|
||||
pub:
|
||||
key string
|
||||
value_type KeyType
|
||||
token_pos int // the position of the token
|
||||
}
|
||||
```
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## StructCheckResult
|
||||
```v
|
||||
struct StructCheckResult {
|
||||
pub:
|
||||
duplicates []string
|
||||
superfluous []string
|
||||
}
|
||||
```
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
#### Powered by vdoc. Generated on: 2 Sep 2025 07:37:54
|
||||
490
aiprompts/v_core/json2/x.json2.md
Normal file
490
aiprompts/v_core/json2/x.json2.md
Normal file
@@ -0,0 +1,490 @@
|
||||
# module x.json2
|
||||
|
||||
|
||||
## Contents
|
||||
- [Constants](#Constants)
|
||||
- [decode](#decode)
|
||||
- [decode_array](#decode_array)
|
||||
- [encode](#encode)
|
||||
- [encode_pretty](#encode_pretty)
|
||||
- [fast_raw_decode](#fast_raw_decode)
|
||||
- [map_from](#map_from)
|
||||
- [raw_decode](#raw_decode)
|
||||
- [Encodable](#Encodable)
|
||||
- [Any](#Any)
|
||||
- [arr](#arr)
|
||||
- [as_map](#as_map)
|
||||
- [as_map_of_strings](#as_map_of_strings)
|
||||
- [bool](#bool)
|
||||
- [f32](#f32)
|
||||
- [f64](#f64)
|
||||
- [i16](#i16)
|
||||
- [i32](#i32)
|
||||
- [i64](#i64)
|
||||
- [i8](#i8)
|
||||
- [int](#int)
|
||||
- [json_str](#json_str)
|
||||
- [prettify_json_str](#prettify_json_str)
|
||||
- [str](#str)
|
||||
- [to_time](#to_time)
|
||||
- [u16](#u16)
|
||||
- [u32](#u32)
|
||||
- [u64](#u64)
|
||||
- [u8](#u8)
|
||||
- [Parser](#Parser)
|
||||
- [decode](#decode)
|
||||
- [[]Any](#[]Any)
|
||||
- [str](#str)
|
||||
- [map[string]Any](#map[string]Any)
|
||||
- [str](#str)
|
||||
- [DecodeError](#DecodeError)
|
||||
- [code](#code)
|
||||
- [msg](#msg)
|
||||
- [Encoder](#Encoder)
|
||||
- [encode_value](#encode_value)
|
||||
- [InvalidTokenError](#InvalidTokenError)
|
||||
- [code](#code)
|
||||
- [msg](#msg)
|
||||
- [Null](#Null)
|
||||
- [from_json_null](#from_json_null)
|
||||
- [Token](#Token)
|
||||
- [full_col](#full_col)
|
||||
- [UnknownTokenError](#UnknownTokenError)
|
||||
- [code](#code)
|
||||
- [msg](#msg)
|
||||
|
||||
## Constants
|
||||
```v
|
||||
const null = Null{}
|
||||
```
|
||||
|
||||
null is an instance of the Null type, to ease comparisons with it.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## decode
|
||||
```v
|
||||
fn decode[T](src string) !T
|
||||
```
|
||||
|
||||
decode is a generic function that decodes a JSON string into the target type.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## decode_array
|
||||
```v
|
||||
fn decode_array[T](src string) ![]T
|
||||
```
|
||||
|
||||
decode_array is a generic function that decodes a JSON string into the array target type.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## encode
|
||||
```v
|
||||
fn encode[T](val T) string
|
||||
```
|
||||
|
||||
encode is a generic function that encodes a type into a JSON string.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## encode_pretty
|
||||
```v
|
||||
fn encode_pretty[T](typed_data T) string
|
||||
```
|
||||
|
||||
encode_pretty ...
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## fast_raw_decode
|
||||
```v
|
||||
fn fast_raw_decode(src string) !Any
|
||||
```
|
||||
|
||||
Same with `raw_decode`, but skips the type conversion for certain types when decoding a certain value.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## map_from
|
||||
```v
|
||||
fn map_from[T](t T) map[string]Any
|
||||
```
|
||||
|
||||
map_from converts a struct to a map of Any.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## raw_decode
|
||||
```v
|
||||
fn raw_decode(src string) !Any
|
||||
```
|
||||
|
||||
Decodes a JSON string into an `Any` type. Returns an option.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## Encodable
|
||||
```v
|
||||
interface Encodable {
|
||||
json_str() string
|
||||
}
|
||||
```
|
||||
|
||||
Encodable is an interface, that allows custom implementations for encoding structs to their string based JSON representations.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## Any
|
||||
## arr
|
||||
```v
|
||||
fn (f Any) arr() []Any
|
||||
```
|
||||
|
||||
arr uses `Any` as an array.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## as_map
|
||||
```v
|
||||
fn (f Any) as_map() map[string]Any
|
||||
```
|
||||
|
||||
as_map uses `Any` as a map.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## as_map_of_strings
|
||||
```v
|
||||
fn (f Any) as_map_of_strings() map[string]string
|
||||
```
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## bool
|
||||
```v
|
||||
fn (f Any) bool() bool
|
||||
```
|
||||
|
||||
bool uses `Any` as a bool.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## f32
|
||||
```v
|
||||
fn (f Any) f32() f32
|
||||
```
|
||||
|
||||
f32 uses `Any` as a 32-bit float.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## f64
|
||||
```v
|
||||
fn (f Any) f64() f64
|
||||
```
|
||||
|
||||
f64 uses `Any` as a 64-bit float.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## i16
|
||||
```v
|
||||
fn (f Any) i16() i16
|
||||
```
|
||||
|
||||
i16 uses `Any` as a 16-bit integer.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## i32
|
||||
```v
|
||||
fn (f Any) i32() i32
|
||||
```
|
||||
|
||||
i32 uses `Any` as a 32-bit integer.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## i64
|
||||
```v
|
||||
fn (f Any) i64() i64
|
||||
```
|
||||
|
||||
i64 uses `Any` as a 64-bit integer.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## i8
|
||||
```v
|
||||
fn (f Any) i8() i8
|
||||
```
|
||||
|
||||
i8 uses `Any` as a 16-bit integer.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## int
|
||||
```v
|
||||
fn (f Any) int() int
|
||||
```
|
||||
|
||||
int uses `Any` as an integer.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## json_str
|
||||
```v
|
||||
fn (f Any) json_str() string
|
||||
```
|
||||
|
||||
json_str returns the JSON string representation of the `Any` type.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## prettify_json_str
|
||||
```v
|
||||
fn (f Any) prettify_json_str() string
|
||||
```
|
||||
|
||||
prettify_json_str returns the pretty-formatted JSON string representation of the `Any` type.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## str
|
||||
```v
|
||||
fn (f Any) str() string
|
||||
```
|
||||
|
||||
str returns the string representation of the `Any` type. Use the `json_str` method. If you want to use the escaped str() version of the `Any` type.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## to_time
|
||||
```v
|
||||
fn (f Any) to_time() !time.Time
|
||||
```
|
||||
|
||||
to_time uses `Any` as a time.Time.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## u16
|
||||
```v
|
||||
fn (f Any) u16() u16
|
||||
```
|
||||
|
||||
u16 uses `Any` as a 16-bit unsigned integer.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## u32
|
||||
```v
|
||||
fn (f Any) u32() u32
|
||||
```
|
||||
|
||||
u32 uses `Any` as a 32-bit unsigned integer.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## u64
|
||||
```v
|
||||
fn (f Any) u64() u64
|
||||
```
|
||||
|
||||
u64 uses `Any` as a 64-bit unsigned integer.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## u8
|
||||
```v
|
||||
fn (f Any) u8() u8
|
||||
```
|
||||
|
||||
u8 uses `Any` as a 8-bit unsigned integer.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## Parser
|
||||
## decode
|
||||
```v
|
||||
fn (mut p Parser) decode() !Any
|
||||
```
|
||||
|
||||
decode - decodes provided JSON
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## []Any
|
||||
## str
|
||||
```v
|
||||
fn (f []Any) str() string
|
||||
```
|
||||
|
||||
str returns the JSON string representation of the `[]Any` type.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## map[string]Any
|
||||
## str
|
||||
```v
|
||||
fn (f map[string]Any) str() string
|
||||
```
|
||||
|
||||
str returns the JSON string representation of the `map[string]Any` type.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## DecodeError
|
||||
```v
|
||||
struct DecodeError {
|
||||
line int
|
||||
column int
|
||||
message string
|
||||
}
|
||||
```
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## code
|
||||
```v
|
||||
fn (err DecodeError) code() int
|
||||
```
|
||||
|
||||
code returns the error code of DecodeError
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## msg
|
||||
```v
|
||||
fn (err DecodeError) msg() string
|
||||
```
|
||||
|
||||
msg returns the message of the DecodeError
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## Encoder
|
||||
```v
|
||||
struct Encoder {
|
||||
pub:
|
||||
newline u8
|
||||
newline_spaces_count int
|
||||
escape_unicode bool = true
|
||||
}
|
||||
```
|
||||
|
||||
Encoder encodes the an `Any` type into JSON representation. It provides parameters in order to change the end result.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## encode_value
|
||||
```v
|
||||
fn (e &Encoder) encode_value[T](val T, mut buf []u8) !
|
||||
```
|
||||
|
||||
encode_value encodes a value to the specific buffer.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## InvalidTokenError
|
||||
```v
|
||||
struct InvalidTokenError {
|
||||
DecodeError
|
||||
token Token
|
||||
expected TokenKind
|
||||
}
|
||||
```
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## code
|
||||
```v
|
||||
fn (err InvalidTokenError) code() int
|
||||
```
|
||||
|
||||
code returns the error code of the InvalidTokenError
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## msg
|
||||
```v
|
||||
fn (err InvalidTokenError) msg() string
|
||||
```
|
||||
|
||||
msg returns the message of the InvalidTokenError
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## Null
|
||||
```v
|
||||
struct Null {
|
||||
is_null bool = true
|
||||
}
|
||||
```
|
||||
|
||||
Null is a simple representation of the `null` value in JSON.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## from_json_null
|
||||
```v
|
||||
fn (mut n Null) from_json_null()
|
||||
```
|
||||
|
||||
from_json_null implements a custom decoder for json2
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## Token
|
||||
```v
|
||||
struct Token {
|
||||
lit []u8 // literal representation of the token
|
||||
kind TokenKind // the token number/enum; for quick comparisons
|
||||
line int // the line in the source where the token occurred
|
||||
col int // the column in the source where the token occurred
|
||||
}
|
||||
```
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## full_col
|
||||
```v
|
||||
fn (t Token) full_col() int
|
||||
```
|
||||
|
||||
full_col returns the full column information which includes the length.
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## UnknownTokenError
|
||||
```v
|
||||
struct UnknownTokenError {
|
||||
DecodeError
|
||||
token Token
|
||||
kind ValueKind = .unknown
|
||||
}
|
||||
```
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## code
|
||||
```v
|
||||
fn (err UnknownTokenError) code() int
|
||||
```
|
||||
|
||||
code returns the error code of the UnknownTokenError
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
## msg
|
||||
```v
|
||||
fn (err UnknownTokenError) msg() string
|
||||
```
|
||||
|
||||
msg returns the error message of the UnknownTokenError
|
||||
|
||||
[[Return to contents]](#Contents)
|
||||
|
||||
#### Powered by vdoc. Generated on: 2 Sep 2025 07:37:54
|
||||
Reference in New Issue
Block a user