Create and modify JSON object variable by adding two diffrent array using JavaScript

Last Reply 12 days ago By kalpesh

Posted 14 days ago

Hi, I have a dynamic Hash as:

[ABC Medical Centre:[2],Atlantic Foot & Ankle Specialists:[0],BillingBridge:(6) [10, 14, 0, 0, 0, 0],Transcriptionstar:[5],theBillingBridge:[1]]

I want to store sum of each array wth corresponding name

example:var BB=BillingBridge has sum: 24 OR

var AFAS= Atlantic Foot & Ankle Specialists has sum 0

and others like the above.

I was thinking to convert the array to JSON and then store the arrays in variables.

Note: Each array is dynamic and keeps growing with more arrays and values inside the HASH.

This is how the Hash comes. I have added two different array

var hashOfArr = {};
 
for(i = 0; i < clients.length; i++) {
    if(!hashOfArr[clients[i]]){
        hashOfArr[clients[i]] = [];
     }
   hashOfArr[clients[i]].push(pending1[i]);
}
console.log(hashOfArr);

 THis is how I have converted to JSON

var chargestot= JSON.stringify(hashOfArr);

Thanks,

Vikash

You are viewing reply posted by: kalpesh 12 days ago.
Posted 12 days ago

Refer the below Thread link for your reference

[Solved] Pass and Save JavaScript Array values to database using jQuery AJAX in ASP.Net

Also You can't ask multiple queries within a question. This is against forum rules and necessary to maintain clean forum.
It is requested Mark Answer the replies when question is answered and ask a new question as a responsible member to help fellow programmers around the world.
Note: If you don't mark answers, people will loose interest in your questions.

I agree, here is the link: https://www.e-iceblue.com/Introduce/spire-office-for-net-free.html