fixed serialisation of JsonArray messages and added tests