OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Pass JSON arrays AWS API

  • Thread starter Thread starter user2165656
  • Start date Start date
U

user2165656

Guest
I have this model JSON schéma:

Code:
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "ArrayINPUT",
  "type": "object",
  "properties": {
    "QueryID": { "type": "integer" },
    "nR": { "type": "integer" },
    "Inarray": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "ids": { "type": "integer" },
          "contents": { "type": "string" }
        }
      }
    }
  }
}

I need to Pass this Inarray array with arrays ids and contents to API AWS

And I don't know what's the format of this inArray?:"?:

Code:
Inarray [0,"sdasd",1,"sdfsdfsdfdgfd",2,"asdjkfbfgbsdhbfhsdfbg"........]

Something like this? or I have to create some special array and put into this array Object which contains this 2 arrays:?

the output what I get: is empty Inarray

Code:
{
  "nR": "5",
  "Inarray": [],
  "QueryID": ""
}

My JSON body mapping template:

Code:
#set($inputRoot = $input.path('$'))
{
  "QueryID" : "$input.params('QueryID')",
  "nR" : "$input.params('nR')",
  "Inarray" : [
##TODO: Update this foreach loop to reference array from input json
#foreach($elem in $input.params('Inarray'))
 {
    "ids" : "$elem.ids",
    "contents" : "$elem.contents"
  } 
#if($foreach.hasNext),#end
#end
]
}
<p>I have this model JSON schéma:</p>
<pre><code>{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "ArrayINPUT",
"type": "object",
"properties": {
"QueryID": { "type": "integer" },
"nR": { "type": "integer" },
"Inarray": {
"type": "array",
"items": {
"type": "object",
"properties": {
"ids": { "type": "integer" },
"contents": { "type": "string" }
}
}
}
}
}
</code></pre>
<p>I need to Pass this Inarray array with arrays ids and contents to API AWS</p>
<p>And I don't know what's the format of this inArray?:"<em>?:</em></p>
<pre><code>Inarray [0,"sdasd",1,"sdfsdfsdfdgfd",2,"asdjkfbfgbsdhbfhsdfbg"........]
</code></pre>
<p>Something like this? or I have to create some special array and put into this array Object which contains this 2 arrays:?</p>
<p>the output what I get: is empty Inarray</p>
<pre><code>{
"nR": "5",
"Inarray": [],
"QueryID": ""
}
</code></pre>
<p>My JSON body mapping template:</p>
<pre><code>#set($inputRoot = $input.path('$'))
{
"QueryID" : "$input.params('QueryID')",
"nR" : "$input.params('nR')",
"Inarray" : [
##TODO: Update this foreach loop to reference array from input json
#foreach($elem in $input.params('Inarray'))
{
"ids" : "$elem.ids",
"contents" : "$elem.contents"
}
#if($foreach.hasNext),#end
#end
]
}
</code></pre>
Continue reading...
 
Top