|
btw,
as a general rule you shoul NOT use object within objects unless you need
a array
of similar objects.
it just creates the need of a lot code you really don't need by keeping
the elements
in one level and there is no Xpath i JSON.
On Sun, Mar 12, 2017 at 11:52 PM, Henrik Rützou <hr@xxxxxxxxxxxx> wrote:
{
"userName": "BERT ",
"userAge": 28,
"userWeight": 180,
"userGender": "M",
"userHeight": "72",
"mID": "GB"
"workoutDate": {
"Month": 2,
"Day": 22,
"Year": 2016
},
"distance": 10.1,
"finishTime": {
"Hours": 13,
"Minutes": 38
},
"pctAverageHeartRateInZone": 0.0,
"averageSpeed": 15.1,
"totalWorkoutTime": {
"Hours": 0,
"Minutes": 40
},
"averageWattsPerHour": 75.0,
"totalCalories": 211.0,
"avgHeartRate": 129.3,
"avgRpm": 62,
"avgLevel": 4
}
or if you have x workoutdates
{
"userName": "BERT ",
"userAge": 28,
"userWeight": 180,
"userGender": "M",
"userHeight": "72",
"mID": "GB"
"workoutDates" [
{ "workoutDate": {
"Month": 2,
"Day": 22,
"Year": 2016
},
"distance": 10.1,
"finishTime": {
"Hours": 13,
"Minutes": 38
},
"pctAverageHeartRateInZone": 0.0,
"averageSpeed": 15.1,
"totalWorkoutTime": {
"Hours": 0,
"Minutes": 40
},
"averageWattsPerHour": 75.0,
"totalCalories": 211.0,
"avgHeartRate": 129.3,
"avgRpm": 62,
"avgLevel": 4
},{ "workoutDate" :
.....
}
]
}
On Sun, Mar 12, 2017 at 11:42 PM, Henrik Rützou <hr@xxxxxxxxxxxx> wrote:
Or you may pot the object into an array [{ ... },{ ....}] // still you
need the comma to separate the
array elements
On Sun, Mar 12, 2017 at 11:41 PM, Henrik Rützou <hr@xxxxxxxxxxxx> wrote:
Jon,
you can't have a object and a object }{ - that is forbidden, but you
can name the objects
"abc" : { ... }, // you still need the comma to separate the abc and
def element
"def" : { ... }
On Sun, Mar 12, 2017 at 11:37 PM, Jon Paris <jon.paris@xxxxxxxxxxxxxx>
wrote:
Thanks Don - I tried a similar approach and also tried adding the [
for an array to get the repeats - but still can't make it work.
I also tried coding some XML (where I understand repeating elements)
and using an on-line convertor to convert it to json - sadly it doesn't
help because it converts it to a series of arrays which is not how the
original data is presented.
Jon Paris
www.partner400.com
www.SystemiDeveloper.com
On Mar 12, 2017, at 6:00 PM, Don Brown <DBrown@xxxxxxxxxx> wrote:correctly
The first part validated correctly and the second part validated
so I modified as follows and the complete string validated correctly.that may
While this now validates if you have not pasted the entire string
be why this change worked.enclosed
I don't know JSON but the repeating section I think needs to be
in [ ] not { }bike. It
{
"userName": "BERT ",
"userAge": 28,
"userWeight": 180,
"userGender": "M",
"userHeight": "72",
"mID": "GB",
"workoutDate": {
"Month": 2,
"Day": 22,
"Year": 2016
},
"distance": 10.1,
"finishTime": {
"Hours": 13,
"Minutes": 38
},
"pctAverageHeartRateInZone": 0.0,
"averageSpeed": 15.1,
"totalWorkoutTime": {
"Hours": 0,
"Minutes": 40
},
"averageWattsPerHour": 75.0,
"totalCalories": 211.0,
"avgHeartRate": 129.3,
"avgRpm": 62,
"avgLevel": 4
}
Don Brown
From: Jon Paris <jon.paris@xxxxxxxxxxxxxx>
To: "Web400@Midrange. Com" <web400@xxxxxxxxxxxx>
Date: 13/03/2017 07:03 AM
Subject: [WEB400] JSON Syntax error
Sent by: "WEB400" <web400-bounces@xxxxxxxxxxxx>
The JSON below is an extract from a file produced by an exercise
has a syntax error apparently but I'm danged if I can see what it is-
admittedly I'm shaky on JSON so it is probably something obvious but...
the
The array/collection/whatever that begins with as "workoutDate" is
part of the file that repeats. I've tried various minor correctionson the
assumption that the error has to be trivial but without success.mailing
{
"userName": "BERT ",
"userAge": 28,
"userWeight": 180,
"userGender": "M",
"userHeight": "72",
"mID": "GB"
} {
"workoutDate": {
"Month": 2,
"Day": 22,
"Year": 2016
},
"distance": 10.1,
"finishTime": {
"Hours": 13,
"Minutes": 38
},
"pctAverageHeartRateInZone": 0.0,
"averageSpeed": 15.1,
"totalWorkoutTime": {
"Hours": 0,
"Minutes": 40
},
"averageWattsPerHour": 75.0,
"totalCalories": 211.0,
"avgHeartRate": 129.3,
"avgRpm": 62,
"avgLevel": 4
}
Can somebody spot what the problem is here.
Jon Paris
www.partner400.com
www.SystemiDeveloper.com
--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400)
listmailing list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.
--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400)
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.
--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400)
mailing list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.
--
Regards,
Henrik Rützou
http://powerEXT.com <http://powerext.com/>
--
Regards,
Henrik Rützou
http://powerEXT.com <http://powerext.com/>
--
Regards,
Henrik Rützou
http://powerEXT.com <http://powerext.com/>
--
Regards,
Henrik Rützou
http://powerEXT.com <http://powerext.com/>
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.