This may seem pedantic, but the json library shouldn't be brought in as a dependency to the majority of SP code. The sad thing is, it looks like you didn't even need to include it- which means some file, somewhere is already doing so (grrrr). This function can be moved to the a MessageHanlder class.