locked
Change the format of Json Data RRS feed

  • Question

  • User-257070954 posted

    I am getting one Json value from API

    [{"Headings":" How do I delete a Budget Line Item?"},{"Headings":" How do I delete a Budget Line Item Test Heading?"}]

    I want to convert  above format to below format

    Headings=["How do I delete a Budget Line Item?","How do I delete a Budget Line Item Test Heading?"]

    How can we achieve above requirment

    Sunday, February 21, 2021 9:44 AM

Answers

  • User-474980206 posted

    what language and where?

    if you trying to change the server ressponse its (assume data is the current response:

      return new { Headings = data.Select(r => r.Headings).ToList()};

    if client side (assume data is deserialized json):

       var newData = {Headings: data.map(r => r.Headings)};

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, February 21, 2021 5:44 PM