Delete the specified element from the Jarray.

Source: Internet
Author: User

stringJsontext ="[{\ "a\": \ "aaa\", \ "b\": \ "bbb\", \ "c\": \ "ccc\"},{\ "a\": \ "aa\", \ "b\": \ "bb\", \ "c\": \ "Cc\"}]"; varMjobj =Jarray.parse (Jsontext); //requirements, remove the value of the a node in the list as \ "Aa\"Ilist<jtoken> _ilist =NewList<jtoken> ();//store items that need to be deletedJarray _jarray =NewJarray (); foreach(varSsinchMjobj)//Find a field and value            {                if((((jobject) SS) ["a"]). ToString () = ="AA") {_ilist.                    ADD (ss); _jarray.                    ADD (ss); Console.Write (_ilist[0]); Console.Write (_ilist[0].                    GetHashCode ()); Console.Write ("\ r \ n---------------------------\ n"); Console.Write ("\ r \ n---------------------------\ n"); Console.Write (_jarray[0]); Console.Write (_jarray[0].                    GetHashCode ()); Console.Write ("\ r \ n---------------------------\ n"); Console.Write ("\ r \ n---------------------------\ n"); Console.Write (mjobj[1].                                   GetHashCode ()); }            }            foreach(varIteminch_ilist)//removal of mjobj valid{mjobj.remove (item); }            foreach(varIteminch_jarray)//removal of mjobj is not valid{mjobj.remove (item); }
View Code

It is valid to delete by _ilist.

Deletion by _jarray is not valid.

Is there anyone who can help me with my advice?

Delete the specified element from the Jarray.

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.