Unable to fetch data in JSON format from API into Spotfire

Hi  All,
The API which i am trying to fetch data looks like this "https://repositery-api.appication-pp.ag/v10/repositeries/?page=0&size=1"

and the iron python code which i am trying to fetch data in JSON format is
 

import clr

clr.AddReference('System.Data')

clr.AddReference('System.Web.Extensions')

import System from System

import DateTime from System.Data

import DataSet, DataTable from System.IO

import StreamReader, StreamWriter, MemoryStream, SeekOrigin from System.Net

import HttpWebRequest from System.Web.Script.Serialization

import JavaScriptSerializer from System

import String, Int32, Single, Double from Spotfire.Dxp.Data

import DataType, DataTableSaveSettings from Spotfire.Dxp.Data.

Import import TextFileDataSource, TextDataReaderSettings

# get data in JSON format

uri = "https://repositery-api.appication-pp.ag/v10/repositeries/?page=0&size=1"

print uri

webRequest = HttpWebRequest.Create(uri)

response = webRequest.GetResponse()

streamReader = StreamReader(response.GetResponseStream())

jsonData = streamReader.ReadToEnd()

js = JavaScriptSerializer() js.MaxJsonLength = Int32.MaxValue;

dataDict = js.Deserialize(jsonData,object)

i am getting error saying " Invalid JSON primitive: ." from the last line of the code . can someone please look into this and help me out

SAMPLE JSON DATA :

{

    "data": [

        {

            "a": "CHEMISTRY",

            "b": 1,

            "c": "Hc",

            "d": 12345,

            "d": "k7t3h0t-jk78-0bnp-0t25-7fg5335gf78b",

            "e": {

                "f": "95366",

                "g": "57998",

                "h": "BALKIJ",

                "i": ""

            },

            "j": {

                "k": 1389,

                "l": "2004-11-25T10:96:41Z",

                "j": "balkij",

                "k": "CHEMISTRY ",

                "l": 12345,

                "e": {

                    "m": "574.0",

                    "n": "3",

                    "o": " BALKIJ ",

                    "p": "ERR098",

                    "q": "jdnd kskd"

                },

                "r": false

            },

            "s": null,

            "t": 96652,

            "u": "98852",

            "v": null,

            "w": null,

            "x": "2004-11-25T10:96:67Z ",

            "y": "hjjn",

            "z": false

        }

    ]

}

Attachments

AttachmentSize
File json.docx12.46 KB

(2) Answers

Login