首页 > 解决方案 > 在将 JSON 字符串提交到 Azure 队列之前找到它的大小

问题描述

我正在创建一个 JSON 字符串以传递给 Azure 消息队列,但它不能大于 64k

我想在提交之前检查尺寸。

这是使用 Newtonsoft 创建它的代码

//add list of stops to StopsList class object
        StopsList stops = new StopsList() { LOBstops = stopsList };
        // Serialize using Newtonsoft.Json
        string jsonString = JsonConvert.SerializeObject(stops);

        //Insert it into the queue for processing
        insertQueueMessage(messageToInsert: jsonString, queueName: queueToUse);

标签: c#json.net

解决方案


推荐阅读