简体   繁体   中英

Problem in converting JSON String Containing multiple Array to C# Array of Array

I have created 2 array in Javascript and then stringified both arrays and then merged the stringified string into a variable to send from client Side to a C# MVC controller but it failed to deserialize into array of array at server side.

var personMainArr = [objStu];
var personimageArr = [imageData];
var jSONdata= JSON.stringify(personMainArr) + JSON.stringify(personimageArr)

The JSON string received at server side is:

[{"Person_Name":"sdfsaf","Person_DOB":"21/08/2019",}][{"PersonImage_FileName":"come.png","PersonImage_FileExtension":"image/png"}]

I want an array of string at server side in C# which should contain both of above array after separation.

You mean like this?

var personMainArr = [objStu];
var personimageArr = [imageData];
var jSONdata = Object.assign(personMainArr, personimageArr)
console.log(JSON.stringify(jSONdata, null, 4))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM