Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
append into json
#4
This is minimal example.

In [1]: import json

In [2]: ds = """
   ...: {"tag": [1, 2, 3]}
   ...: """

In [3]: js = json.loads(ds)

In [4]: js['tag'].append(4)

In [5]: json.dumps(js)
Out[5]: '{"tag": [1, 2, 3, 4]}'
Could you show, what did you try so far?
Reply


Messages In This Thread
append into json - by luisbatalla - Mar-08-2020, 10:01 PM
RE: append into json - by scidam - Mar-09-2020, 01:09 AM
RE: append into json - by luisbatalla - Mar-09-2020, 03:09 AM
RE: append into json - by scidam - Mar-09-2020, 07:16 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  .json overwrites, rather than append?? Clives 12 5,025 Jun-07-2021, 04:13 PM
Last Post: buran
  Append JSON's and write to file faqsap 4 3,032 May-15-2020, 04:20 PM
Last Post: faqsap
  Cant Append a word in a line to a list err "str obj has no attribute append Sutsro 2 2,743 Apr-22-2020, 01:01 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020