json-rust icon indicating copy to clipboard operation
json-rust copied to clipboard

Can not be indexed by u32

Open amyipdev opened this issue 3 years ago • 1 comments

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?

amyipdev avatar Apr 16 '21 03:04 amyipdev

Hi, JsonValue can only be indexed by usize.

karx1 avatar Oct 18 '21 23:10 karx1