C# Windows app updating JSON file error.

I am writing a application that reads and updates a JSON file.
I can read it OK but when I try to updaed it, I get the following error:
Severity      Code      Description      Project      File      Line      Suppression State
Error      CS0656      Missing compiler required member 'Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create'

The code I am using to update is:

 public bool SetSystemOptions(int MinRxLThreshold, ref string messag)
        {
            SysSettings SysSetting;
            bool Success = true;
            string json = File.ReadAllText("settings.json");
            dynamic jsonObj = Newtonsoft.Json.JsonConvert.DeserializeObject(json);
            jsonObj[0]["Password"] = "new password";
            string output = Newtonsoft.Json.JsonConvert.SerializeObject(jsonObj, Newtonsoft.Json.Formatting.Indented);
            File.WriteAllText("settings.json", output);

            return Success;
}
Spike UKCTOAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Fernando SotoRetiredCommented:
Please post a sample json file that the code is using. Thanks.
0
Spike UKCTOAuthor Commented:
{
    "min_scans": 5,
    "password": 5,
    "user": 40,
    "threshold_meters": 50,
    "min": 1000,
    "max": 100,
    "invalidthreshold": 120,
    "invalid_drop": false,
    "filter_params": false
}
0
Fernando SotoRetiredCommented:
Try changing the following line in your code from this
 jsonObj[0]["Password"] = "new password";

Open in new window

to this
 jsonObj["Password"] = "new password";

Open in new window

0
Bootstrap 4: Exploring New Features

Learn how to use and navigate the new features included in Bootstrap 4, the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile-first websites.

Spike UKCTOAuthor Commented:
Tried that- didn't help. Any other ideas?
0
Fernando SotoRetiredCommented:
In the solution I posted I used the Jason structure you posted and got the result. So what did it returned In your project and what where you expecting.
0
Spike UKCTOAuthor Commented:
Istill get the error (when I try to cmpile the project):

Severity      Code      Description      Project      File      Line      Suppression State
Error      CS0656      Missing compiler required member 'Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create'
0
Fernando SotoRetiredCommented:
Please see this Microsoft link on this issue.  Compiler Error CS0656
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Spike UKCTOAuthor Commented:
Solved
0
Fernando SotoRetiredCommented:
Please supply the resolution for others in the future having the same issue.

Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
compiler

From novice to tech pro — start learning today.