Add extra infomation to Enum

I have a large Enum like the one in below.

enum Json {
True,
False
Null,
Array(Vec),
}

I'd like to add a property or indicator to Json::Array to indicate which element has changed.

Json::Array(vec![Json::True, Json,False, Json::Null]), and assume I changed Json::True to Json::Null.

Json::Array(vec![Json::Null, Json,False, Json::Null]). I want to add an indicator to Json::Array to tell me I have changed 0th element in Array.

I personally dont want to add idx to enum directly,.
Array(Vec, idx),

I'm haven't find a good way to do this. Is there any other ways of doing this.

Best

Why isn't storing the index "a good way"?

You mean store it in another place? @H2CO3.

The problem is I would come across the cases the nested array. Then the whole thing would come traverse a tree problem.

I mean why don't you add the index to the Array variant? Just like in your last example, Array(Vec<_>, usize).

I'm sorry but I don't understand this.

Please follow the formatting guidelines

I think adding an index as you did in the last example should be fine.

Or you could create another struct for that kind of data, and then you can implement some logic to tell if there was any changes.