JSON

patrick

Well-known member
Joined
Dec 5, 2021
Messages
256
Programming Experience
1-3
hello
C#:
var array[] = {A/O, B/L};

array.replace("/\//g, "\\/");

var temp = JSON.parse(JSON.Stringify(array));

temp.forEach(function(element)
{
      element.A/O = element.A/O /1000); //<============ in JSON, Special characters are not recognized ( Slash / )
}
 
Last edited by a moderator:
Looks like JavaScript, rather than C#. How is this a C# question? For that matter, what is the question?
 
Looks like JavaScript, rather than C#. How is this a C# question? For that matter, what is the question?
C#:
List<Dictionary<string, object>> data = null;
data = {A/O, B/L};
var temp = JSON.parse(JSON.Stringify(JsonConvert.SerializeObject(data)));

temp.forEach(function(element)
{
      element.A/O = element.A/O ; //<============ in JSON, Special characters are not recognized ( Slash / )
}
 
Last edited by a moderator:
Still doesn't look like valid C#.
 
Still doesn't look like valid C#.

C#:
function GridBinding() {
  
    if (null == searchData || searchData.length <= 0) {
        dataProvider.fillJsonData(null, { count: 0 });
        return;
    }

    var unit = $('#sel_unit').val();

    dataProvider.fillJsonData(null, { count: 0 });

    var tempData1 = JSON.parse(JSON.stringify(searchData));
    var tempData2 = [];

    tempData1.forEach(function (element) {
        element.AO = element.AO / 1000; // <===value changes
            
        tempData2.push(element);
    });
 
If you want some javascript converting to C#, please ask ChatGPT to do it for you. If you have a specific problem with your code you need to tell us what it is. Right now what you've done is the virtual equivalent of printing out some code, taking it to your supervisor, throwing it in their face and walking away without a word.. I'm sure you wouldn't do that in real life..
 

Latest posts

Back
Top Bottom