locked
How can I "data map" two different JSON structures? RRS feed

  • Question

  • I'm trying to find an open-source tool or some knowledge how to code a tool that can be used to map 2 different JSON structures.

    Tool description: upload 2 different JSON structures, data map one to another(for example with a drag-and-drop functionality), and generate an outcome.

    Look code example below:

    Input files:

    JSON 1

    {
      "checked": false,
      "id": 1,
      "name": "A green door"
    }

    JSON 2

    {
       "isItChecked": false,
       "identification": 1,
       "firstandlastname": "A Green Door"
    }

    Now link element "checked" to "isItChecked", "id" to "identification" and "name" to "firstandlastname".

    Hit generate button and outcome has to be something like this:

    JSON3

    {
     "checked":"{{body.isItChecked}}",
     "id":"{{body.identification}}",
     "name":"{{body.firstandlastname}}"
    }

    Hope i explained my question well by the example above,

    Thanks in advance!




    Tuesday, April 9, 2019 6:29 AM

All replies

  • Hi

    Thank you for posting here.

    For your question, could you tell me how did you get the third jason string from jason1 and jason2?

    We need some code to test it.

    We are waiting for your update.

    Best Regards,

    Jack


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, April 10, 2019 7:23 AM
  • Hello,

    The third JSON string is how I want my output to be, look below:

    INPUT

    JSON1 - JSON 2

    PROCES

    Combining these 2 by a user friendly, non coding GUI

    OUTPUT

    JSON3

    Hope I explained myself here.

    Kind regards,

    Niels

    Wednesday, April 10, 2019 7:40 AM
  • Hi

    Thanks for the feedback.

    Based on my research, I could not find a tool to complete your task. However, I write a simple code for it, you could have a look.

    public class body
            {
                public static bool isItChecked { get; set; }
                public static int identification { get; set; }
                public static string firstandlastname { get; set; }
            }
    
            private void button1_Click(object sender, EventArgs e)
            {
                body.isItChecked = false;
                body.identification = 1;
                body.firstandlastname = "A green door";
                string text1 = richTextBox1.Text;
                string text2 = richTextBox2.Text;
                string text3 = null;
                text3 = text1.Replace("false", $"{ body.isItChecked}");
                text3 = text1.Replace("1", $"{ body.identification}");
                text3= text1.Replace("A green door", $"{ body.firstandlastname}");
    
                richTextBox3.Text = text3;
            }
    

    Best Reagrds,

    Jack


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, April 11, 2019 6:45 AM