Given a json in string format, swap its key and values.
The interviewer was looking for clean maintainable code with test cases.
{
"key1": "A",\n" +
"key2": 5,\n" +
"key3": 4.5,\n" +
"key4": { "key5": "value5", "key6": [1,2,3,4,5] }\n" +
}";
Implement method, swapKV(String jsonString, String separator, String keyValueSeparator)
For example: swapKV( jsonString, ",", ":")
The , separates multiple kv entries in json