When parsing Filing history responses I noticed the json was invalid due to uppercase characters in boolean values. An example response for company number 05226269
, filing transaction MDA4MzY4NDIzM2FkaXF6a2N4
looks as follows:
{
"links": {
"self": "/company/05226269/filing-history/MDA4MzY4NDIzM2FkaXF6a2N4",
"document_metadata": "https://document-api.companieshouse.gov.uk/document/VlawMgWF1apT7hCdgFzC1nZ-o8x3-xiag2q7AubHIG8"
},
"transaction_id": "MDA4MzY4NDIzM2FkaXF6a2N4",
"description": "incorporation-company",
"date": "2004-09-09",
"paper_filed": True,
"category": "incorporation",
"type": "NEWINC",
"pages": 8
}
Any chance this could be changed to the valid JSON true
?
@jamesg87
I’ve checked the source data for the request and it returns true
rather than True
. I have also used curl (example below) to query the data and this returns true
as well.
curl -v -u <<YOUR_API_KEY>> https://api.companieshouse.gov.uk/company/05226269/filing-history/MDA4MzY4NDIzM2FkaXF6a2N4
Would be interested to know what technology stack is being used so we can potentially determine if this is a particular issue to yourself or the technology.
Thanks,
Mark.
Hi Mark.
You are right, this was my error. I’m using the python Requests library to build a wrapper around the API. The Requests libraries json
method parses returned JSON into python objects rather than actual JSON, hence the uppercase True
.
Using the python json
library to dump to a JSON object (json.dumps(return.json())
outputs the expected format
Thanks,
James
Glad to hear its resolved 