Encode device metadata as json and then stringify it.