Check JSON errors and use marshal/unmarshal for commands