Click here to Skip to main content
15,867,488 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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..
Posted
Comments
Tejas Vaishnav 6-Jan-15 6:49am    
can you share more info, like you want to call any webservice to pass your image as Base64 string in jason, or your are creating web service to send respose to client as Base64 string.

1 solution

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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900