v0.0.10
Added reversing functions ReverseTranslateStrings(sourcemapstring, newmapstring) and ReverseTranslate(sourcemap, newmap) to handle finding value locations between two JSON bodies. Only handles strings for now
findKeys := `{
"findme": "This is the value to find",
"subkey": {
"findAnother": "This is another value to find",
"subsubkey": {
"findAnother2": "Amazing subsubkey to find"
},
"sublist": [
"This is a list",
"This is a list",
"Cool list item",
"This is a list"
],
"objectlist": [{
"key1": "This is a key"
},
{
"key1": "Another cool thing"
}]
}
}`
// Goal is to FIND the schemaless with key "findme" in the following data
findInData := `{
"key1": "This is the value to find",
"key2": "This is another value to find",
"key3": "Amazing subsubkey to find",
"key4": "Cool list item",
"key5": "Another cool thing"
}`
// Expected output
expectedOutput := `{
"key1": "findme",
"key2": "subkey.findAnother",
"key3": "subkey.subsubkey.findAnother2",
"key5": "subkey.objectlist.#1.key1",
"key4": "subkey.sublist.#2"
}`
reversed, err := ReverseTranslateStrings(findKeys, findInData)