0

I have the text data which has the format as shown below. How can I convert it into a JSON using python?

{"CRW_CODE":"CREW81","CRW_LASTSAVED":"2020-03-17 10:49:49.0","CRW_DESC":"Crew 37"}
{"CRW_CODE":"CREW82","CRW_LASTSAVED":"2020-03-17 10:49:53.0","CRW_DESC":"Crew 37"}
colidyre
  • 4,170
  • 12
  • 37
  • 53
Pradeep
  • 3
  • 1
  • 3
  • Did you try this previous SO answer? https://stackoverflow.com/questions/4528099/convert-string-to-json-using-python – pastaleg Mar 20 '20 at 09:33

1 Answers1

0

you can use json module

import json
json.loads(data)
McCray
  • 83
  • 1
  • 7
  • Thanks for your input....This code doesn't works if we have multiple tags like below :{ "CRW_CODE": "ABCDEFGHIJKLMNOPQRSTUVWX", "CRW_LASTSAVED": "ABCDEFGHIJKLMNOPQR", "CRW_DESC": "ABCDEFGHIJKLMNOPQRSTUV" } { "CRW_CODE": "ABCDEFGHIJKLMNOPQRSTUVWX", "CRW_LASTSAVED": "ABCDEFGHIJKLMNOPQR", "CRW_DESC": "ABCDEFGHIJKLMNOPQRSTUV" } – Pradeep Mar 20 '20 at 09:48