Fix a bug in json parsing

Fix a bug where we misidentify special mode '$' keys in extended json
parsing.  Basically, we have to verify length for both strings, rather
than relying on prefix matches with strncmp.  We also miscounted length
for the prefix match, allowing any '$' key that started with an '$i' to
match '$id'