Function sj::parse

source ·
pub fn parse<R>(src: &mut R) -> Result<Json>
where R: Read,
Available on crate feature std only.
Expand description

§Parses a stream

§Notes

  • The stream is used as-is.
  • You can also use implementation of TryFrom<Vec<u8>> for Json.
  • To prevent attacks, consider limiting your source via Read::take().
  • On machines whose pointer width is one of 8/16/32/64, numbers will be parsed by either i64/u64/f64. On other machines, numbers will be parsed by isize/usize/f64. So, even though you can convert i128/u128 into Number and format them into JSON string, but: parsing i128/u128 is not supported on some machines.

About strings with escaping Unicode characters:

  • JSON specification only supports this form \u---- (each - is a hexadecimal character). This function works on that form.
  • Some other programming languages have support for this form \x--, which is not described in specification. This function can also work on that form, if you enable feature x-unicode.