formatting json structure in code