This is unreleased documentation for the main (development) branch of serde_luaq.
You can find the latest stable documentation on docs.rs.

from_json_value

Function from_json_value 

Source
pub fn from_json_value(
    value: Value,
) -> Result<LuaValue<'static>, LuaConversionError>
Expand description

Converts a JSON value to a Lua value.

§Caveats

There are a number of caveats to the conversion process, which may result in data loss, changes or strangely-formed data, such that running to_json_value(from_json_value(a)) may not return the same value.

§Numbers

serde_json stores integers using either i64 or u64. Integers > i64::MAX will be casted to f64, resulting in a loss of precision, but JSON’s Number type is an f64 anyway.

serde_json drops non-finite numbers. When its arbitrary_precision feature is enabled, it will store non-finite numbers, but will still drop them when calling as_f64.

§Arrays

Arrays are converted to a LuaValue::Table with LuaTableEntry::Value entries (ie: implicit keys).

§Objects

Objects are converted a LuaValue::Table in the order serde_json returned (which may not be the same as the order in the file).

Entries are a LuaTableEntry::NameValue if the object’s key is a valid Lua identifier, or LuaTableEntry::KeyValue otherwise.