I'm requesting some JSON data from a pod's web server via the Kubernetes API proxy verb. That is:
corev1 = kubernetes.client.CoreV1Api()
res = corev1.connect_get_namespaced_pod_proxy_with_path(
'mypod:5000', 'default', path='somepath', path2='somepath')
print(type(res))
print(res)
The call succeeds and returns a str
containing the serialized JSON data from my pod's web service. Unfortunately, res
now looks like this ... which isn't valid JSON at all, so json.loads(res)
denies to parse it:
{'x': [{'xx': 'xxx', ...
As you can see, the stringified response looks like a Python dictionary, instead of valid JSON. Any suggestions as to how this convert safely back into either correct JSON or a correct Python dict
?