0

I'm trying to make my json compatible with Google ML, which after some searching means having one line per input instance (Input instances are not in JSON format.)

How can I change my code to have only one line per instance? (img variable is the image I encoded to base64)

json.dumps({"inputs": {"b64": img}})
Anthon
  • 69,918
  • 32
  • 186
  • 246
K41F4r
  • 1,443
  • 1
  • 16
  • 36
  • Can this thread help you? https://stackoverflow.com/questions/38915183/python-conversion-from-json-to-jsonl – AlexandreS Oct 23 '19 at 13:16

1 Answers1

2

The format you're referring to is called json-lines (.jl for a file extension).
You can use the json-lines python package in place of json.dumps.

Teodor Ivanov
  • 184
  • 1
  • 8