maciejhirsz / json-rust

JSON implementation in Rust
Apache License 2.0
563 stars 63 forks source link

Can not be indexed by u32 #200

Open amyipdev opened 3 years ago

amyipdev commented 3 years ago

Error:

error[E0277]: the type `JsonValue` cannot be indexed by `u32`
  --> src/lib.rs:65:12
   |
65 |     while !parsed["functions"][c].is_null() {
   |            ^^^^^^^^^^^^^^^^^^^^^^ `JsonValue` cannot be indexed by `u32`
   |
   = help: the trait `Index<u32>` is not implemented for `JsonValue`

I'm guessing a manually typed in number automatically converts itself to a compatible type for indexing?

karx1 commented 2 years ago

Hi, JsonValue can only be indexed by usize.