This is the way to go, if you are tied to JSON for some reason. A far better solution is to get rid of JSON if most of your stack is a typed stack and then convert to JSON as late as possible.
Custom JSON which people invent as they go along is just going to present your system with pain over time.