Fix JSON config parsing bug and add unit test