Question

JSON – Get Attribute values from file

  • 14 November 2017
  • 5 replies
  • 2 views

Badge

I have a JSON file and need to extract the attributes from this file.

How can I do it?

Example:

{

 

"id" : null,

 

"revisionNumber" : "1.0.0",

 

"periodTimeInterval" : {

 

"start" : "2014-10-10T01:00Z",

 

"end" : "2014-10-11T01:00Z"

 

},

 

"timeSeries" : [

 

{

 

"id" : "silo:67688:536653:raw",

 

"name" : null,

 

"tskeys" : null,

 

"dimensions" : {

 

"attribute" : [

 

{

 

"value" : {

 

"item" : [],

 

"type" : "String",

 

"value" : null

 

},

 

"name" : "Datenquelle"

 

},

 

{

 

"value" : {

 

"item" : [],

 

"type" : "Integer",

 

"value" : "0"

 

},

 

"name" : "Netzbetriebsplanung"

 

},

 

{

 

"value" : {

 

"item" : [

 

{

 

"key" : "0",

 

"name" : "from",

 

"type" : "DatumZeit",

 

"value" : "1990-01-01T00:00:00.000"

 

},

 

{

 

"key" : "0",

 

"name" : "factor",

 

"type" : "Float",

 

"value" : "1"

 

},

 

{

 

"key" : "0",

 

"name" : "constant",

 

"type" : "String",

 

"value" : "0"

 

}

 

],

 

"type" : "Zeitwerte",

 

"value" : null

 

},

 

"name" : "Bilanzfaktor"

 

},

 

{

 

"value" : {

 

"item" : [],

 

"type" : "NotizRtf",

 

"value" : null

 

},

 

"name" : "Notiz"

 

},

 

{

 

"value" : {

 

"item" : [],

 

"type" : "NotizUnformatiert",

 

"value" : null

 

},

 

"name" : "Zeitreihenqualit_t"

 

},

 

"measures" : {

 

"attribute" : [

 

{

 

"value" : {

 

"item" : [],

 

"type" : "int",

 

"value" : "67688"

 

},

 

"name" : "abfrageid"

 

},

 

{

 

"value" : {

 

"item" : [],

 

"type" : "int",

 

"value" : "536653"

 

},

 

"name" : "zeitreiheid"

 

},

 

{

 

"value" : {

 

"item" : [],

 

"type" : "string",

 

"value" : "RAW"

 

},

 

"name" : "datenquelle"

 

},

 

{

 

"value" : {

 

"item" : [],

 

"type" : "string",

 

"value" : "OHNE"

 

},

 

"name" : "datenausgerollt"

 

},

 

],

 

"name" : null

 

},

 

"period" : [

 

{

 

"timeInterval" : {

 

"start" : "2014-10-10T01:00Z",

 

"end" : "2014-10-11T01:00Z"

 

},

 

"resolution" : "PT60M",

 

"point" : [

 

{

 

"datumZeitUTC" : 1507597200000,

 

"position" : 1,

 

"quantity" : 45.48

 

},

 

{

 

"datumZeitUTC" : 1507600800000,

 

"position" : 2,

 

"quantity" : 43.69

 

},

 

{

 

"datumZeitUTC" : 1507604400000,

 

"position" : 3,

 

"quantity" : 42.41

 

}

 

]

 

}

 

]

 

}

 

]

 

}

Thank you very mutch for any suggestions.

Zoran


5 replies

Badge

There is a wrong syntax in your json example.

Userlevel 2
Badge +17

Hi @zoran68, generally you can use JSON reader or JSON*** transformers to parse a JSON document. The way depends on what fearture(s) you need to extract from the document.

Note: As @jneujens mentioned, your document is not a valid JSON. Please post a valid JSON document if you expect a more specific answer.

Badge

Hi @zoran68, generally you can use JSON reader or JSON*** transformers to parse a JSON document. The way depends on what fearture(s) you need to extract from the document.

Note: As @jneujens mentioned, your document is not a valid JSON. Please post a valid JSON document if you expect a more specific answer.

testdaten-forum.jsonHi takashi, I think this is the copy paste Problem.

 

I attached the sample file and hope at the help.

 

 

Badge

testdaten-forum.json

I attached the sample data and hope you can help me.

Thanks

Zoran

Userlevel 2
Badge +17

testdaten-forum.json

I attached the sample data and hope you can help me.

Thanks

Zoran

The document still contains wrong syntax. Any software cannot parse it unfortunately.

Reply