Change json_encode to serialize as it needs to keep the right data, otherwise it would need to be mapped once more