I have a json like so:
json = { \"key1\" : \"watevr1\", \"key2\" : \"watevr2\", \"key3\" : \"watevr3\" }
Now, I want to know the index of a key
What you are after are numerical indexes in the way classic arrays work, however there is no such thing with json object/associative arrays.
"key1", "key2" themeselves are the indexes and there is no numerical index associated with them. If you want to have such functionality you have to assiciate them yourself.