Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. JavaScript
  4. Merging 2 different JSON objects

Merging 2 different JSON objects

Scheduled Pinned Locked Moved JavaScript
jsontutorialquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    Farhad Eft
    wrote on last edited by
    #1

    Hi, I have two JSON objects: JSON Object 1

    [{
    "date":
    [
    "date-value1",
    "date-value2,
    ........ ,
    "date-value729"
    ]
    }]

    JSON Object 2

    {
    "data": [
    {
    "body": [ "body1" ],
    "link": "link1",
    "title": [ "title1" ]
    },
    ...........
    {
    "body": [ "body729" ],
    "link": "link729",
    "title": [ "title729" ]
    }
    ]
    }

    How can I merge the properties of these 2 JSON objects and have the following example as an output for all 729 records of data:

    {
    "data": [
    {
    "body": [ "body1" ],
    "link": "link1",
    "title": [ "title1" ].
    "date": "date1"
    },
    ...........
    {
    "body": [ "body729" ],
    "link": "link729",
    "title": [ "title729" ]
    "date": "date729"
    }
    ]
    }

    Examples that I found online are mainly about merging two identical JSON objects. Thank you in advance for your time and consideration.

    L 1 Reply Last reply
    0
    • F Farhad Eft

      Hi, I have two JSON objects: JSON Object 1

      [{
      "date":
      [
      "date-value1",
      "date-value2,
      ........ ,
      "date-value729"
      ]
      }]

      JSON Object 2

      {
      "data": [
      {
      "body": [ "body1" ],
      "link": "link1",
      "title": [ "title1" ]
      },
      ...........
      {
      "body": [ "body729" ],
      "link": "link729",
      "title": [ "title729" ]
      }
      ]
      }

      How can I merge the properties of these 2 JSON objects and have the following example as an output for all 729 records of data:

      {
      "data": [
      {
      "body": [ "body1" ],
      "link": "link1",
      "title": [ "title1" ].
      "date": "date1"
      },
      ...........
      {
      "body": [ "body729" ],
      "link": "link729",
      "title": [ "title729" ]
      "date": "date729"
      }
      ]
      }

      Examples that I found online are mainly about merging two identical JSON objects. Thank you in advance for your time and consideration.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      I already answered this in the C# forum; please do not repost. And please make up your mid, is this C# or Javascript?

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups