json

package
v0.0.0-...-6fc7a22 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 11, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

The json package is used to encode and decode rbxfile objects to the JSON format.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(b []byte) (root *rbxfile.Root, err error)

func Encode

func Encode(root *rbxfile.Root) (b []byte, err error)

func InstanceFromJSONInterface

func InstanceFromJSONInterface(iinst interface{}, refs rbxfile.References, propRefs *[]rbxfile.PropRef) (inst *rbxfile.Instance, ok bool)

InstanceFromJSONInterface converts a generic interface produced by json.Unmarshal into a rbxfile.Instance.

The refs argument is used to keep track of instance references.

The propRefs argument is populated with a list of PropRefs, specifying properties of descendant instances that are references. This should be used in combination with refs to set each property after all instance have been processed.

func InstanceToJSONInterface

func InstanceToJSONInterface(inst *rbxfile.Instance, refs rbxfile.References) interface{}

InstanceToJSONInterface converts a rbxfile.Instance to a generic interface that can be read by json.Marshal.

The refs argument is used by to keep track of instance references.

func RootFromJSONInterface

func RootFromJSONInterface(iroot interface{}) (root *rbxfile.Root, ok bool)

RootToJSONInterface converts a generic interface produced json.Unmarshal to a rbxfile.Root.

func RootToJSONInterface

func RootToJSONInterface(root *rbxfile.Root) interface{}

RootToJSONInterface converts a rbxfile.Root to a generic interface that can be read by json.Marshal.

func ValueFromJSONInterface

func ValueFromJSONInterface(typ rbxfile.Type, ivalue interface{}) (value rbxfile.Value)

ValueFromJSONInterface converts a generic interface produced by json.Unmarshal to a rbxfile.Value.

When the value is rbxfile.TypeReference, the result is a rbxfile.ValueString containing the raw reference string, expected to be dereferenced at a later time.

func ValueToJSONInterface

func ValueToJSONInterface(value rbxfile.Value, refs rbxfile.References) interface{}

ValueToJSONInterface converts a value to a generic interface that can be read by json.Marshal.

The refs argument is used when converting a rbxfile.ValueReference to a string.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL