在JSON中添加图像数据(Base64) [英] Adding Image data(Base64) in JSON

查看:1733
本文介绍了在JSON中添加图像数据(Base64)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在json中添加图像数据。???



我已将图像数据转换为Base64字符串,我必须在JSon中添加此base64字符串..

How to add image data in json.???

I have converted the image data in to Base64 string and i have to add this base64 string in JSon..

推荐答案

创建一个具有必需属性的类,如Image Id,Image等。存储这些prooperties中的值,并使用Newtonsoft Library将其转换为JSON。



您可以按如下方式将其序列化为json对象。



ImageProperties image = new ImageProperties();

image.ImageId = 101;

image.ImageData =xxxxx;

JsonConvert.SerializeObject(图片);



如果您需要任何帮助,请告诉我。以下是链接将帮助您参考有关Json与NewtonSoft库的内容。
Create a class with required properties like Image Id,Image etc.Store the values in those prooperties and convert it into JSON using Newtonsoft Library.

You can serialize it into json object as follows.

ImageProperties image = new ImageProperties();
image.ImageId=101;
image.ImageData = "xxxxx";
JsonConvert.SerializeObject(image);

Let me know if you need any help.Following link will help for you reference regarding the Json with NewtonSoft library.


这篇关于在JSON中添加图像数据(Base64)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆