Documentation ¶
Overview ¶
The json package is used to encode and decode rbxfile objects to the JSON format.
Index ¶
- func Decode(b []byte) (root *rbxfile.Root, err error)
- func Encode(root *rbxfile.Root) (b []byte, err error)
- func InstanceFromJSONInterface(iinst interface{}, refs rbxfile.References, propRefs *[]rbxfile.PropRef) (inst *rbxfile.Instance, ok bool)
- func InstanceToJSONInterface(inst *rbxfile.Instance, refs rbxfile.References) interface{}
- func RootFromJSONInterface(iroot interface{}) (root *rbxfile.Root, ok bool)
- func RootToJSONInterface(root *rbxfile.Root) interface{}
- func ValueFromJSONInterface(typ rbxfile.Type, ivalue interface{}) (value rbxfile.Value)
- func ValueToJSONInterface(value rbxfile.Value, refs rbxfile.References) interface{}
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 ¶
RootToJSONInterface converts a generic interface produced json.Unmarshal to a rbxfile.Root.
func RootToJSONInterface ¶
RootToJSONInterface converts a rbxfile.Root to a generic interface that can be read by json.Marshal.
func ValueFromJSONInterface ¶
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.