c#


How can we prepare a json object where objects has different attributes


I am working on a WEB API and need to return json result in this format:
{
"responseID": "b806d829-1d9c-4c69-8d7a-576ffc4de555",
"orders": [
{
"id": order1,
"status": "Issued",
"statusDate": "2017-04-05T10:00:56.1549453+00:00",
"amount": 100000,
"quantity": 10,
"fee": 99,
"comments": "some comments"
},
{
"id": order2,
"status": "Declined",
"statusDate": "2017-04-05T10:00:56.1549453+00:00",
}
]
}
Can we prepare a json object like this where the objects within array has different attributes like in the above example order1 has 7 attributes but order2 has only 3.
My understanding is that the only way to achieve the desired results is to change the format of json object as below:
{
"responseID": "b806d829-1d9c-4c69-8d7a-576ffc4de555",
"issuesOrders": [
{
"id": order1,
"status": "Issued",
"statusDate": "2017-04-05T10:00:56.1549453+00:00",
"amount": 100000,
"quantity": 10,
"fee": 99,
"comments": "some comments"
} ],
"declinedOrders": [
{
"id": order2,
"status": "Declined",
"statusDate": "2017-04-05T10:00:56.1549453+00:00",
}
]
}
Is my understanding is correct?

Related Links

Uploading documents from Amazon S3 to CloudSearch using .NET SDK
Import multiple XML files into Excel
Twilio rest api error code 21612
Generate list with random numbers. Sort and total sum
“Windows.UI.Xaml.Markup.XamlParse.Exception”
Am I using ContinueWith correctly?
Load multiple methods from dll at runtime C#
bind images in buttons in a FlipView windows app store
Efficient way of shifting row down in ASP table
How to run DirectX code samples on Visual Studio 2015 and Windows 10?
How to backup the database from the server to the client computer using asp.net page
How to convert Android.Net.Uri path to physical path in xamarin?
WPF Datagrid has data in the rows but not displaying text
c#.net Word add-in
How to select only content in the sheet rather all unused/empty cell value
Only Half of a Deck of Cards Being Created [closed]

Categories

HOME
grizzly
ftp
display
python-requests
ebay-api
azure-database-mysql
django-middleware
ms-application-insights
overrides
sms
terminal
jshell
autocad
liquidsoap
meson-build
markdown
samsung-gear-s2
revit-api
sahi
oms
wowza
fetch
decoding
swift3.1
responsive
web-testing
internet-explorer-7
samba
jq
matlab-gui
aws-iot
poisson
datastax-enterprise
windows-mobile
proof-general
meteor-accounts
pypy
pushpad
wordpress-rest-api
unity3d-5
jsonapi-resources
restler
zimbra
tunnel
wunderground
ansible-inventory
kdevelop
kepserverex
nsdateformatter
idea-plugin
collation
apiman
smooth-streaming
python-venv
gridgain
amazon-fire-tv
chrome-custom-tabs
reqif
mef
serverless-architecture
serialversionuid
ajv
multi-select
scrollmagic
catalyst
lightspeed
group
esprima
indoor-positioning-system
cherry-pick
laterjs
aws-kms
jde
fadein
app-data
android-contentresolver
identifying
page-flipping
pushwoosh
jsoncpp
httpmodule
gmaps4jsf
random-access
javadb
gnip
sat4j
serializer
reactjs-native
ekevent
xcode6.1-gm-seed
google-mirror-api
mobile-robots
grape-api
octokit
kohana-orm
typography
extensibility
android-library
proj4
outlook-object-model
magicsuggest
metapost
quit
tasklist
mail-gem
netbiscuits
webpage-screenshot
github-archive
flatten
jqueryi-ui-buttonset
mcpd
backlight
method-call
hs-err
text-manipulation
nyromodal
nstoolbar

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html