C # Basics-a pit that uses JSON to pass values to the console program

Source: Internet
Author: User

Last week encountered a very strange pit, first wrote two programs, the first program output into a DLL, the second program is a console program.

In the first program, I used the process to start a second program and passed in a JSON as a parameter, namely:

Process.Start (Program2.exe, Jsonpara);

This Jsonpara converts a list<list<string>> generic to a string type.

As a result, when I was excited to wait for the moment of the program, the console error, Newtonsoft.Json.reader Balabala errors ...

Troubleshooting process:

1) Program Two control console parameters debugging, error-free ...

2) Program One check JSON is not correct, error-free ...

3) Program two console output incoming parameters, Error!!!

cause : JSON escapes the quotation marks ... Of course, your debugging in the program one is displayed correctly, but it changes when the console receives it!!!

Solution: For the stability of the program, the direct JSON is written to a TXT file, and then the console program to read the file.

Note: If you go to the console to modify the escaped parameters and then read correctly, or in the program one to modify the JSON parameters, so that it escaped to become the correct parameters, the personal feel the outweigh the gains, has not been written to read the file convenient.

C # Basics-a pit that uses JSON to pass values to the console program

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.