[GODRIVER-946] Add IndentExtJSON and MarshalExtJSONIndent functions Created: 09/Apr/19  Updated: 02/Nov/21  Resolved: 02/Nov/21

Status: Closed
Project: Go Driver
Component/s: BSON
Affects Version/s: None
Fix Version/s: 1.8.0

Type: Improvement Priority: Major - P3
Reporter: David Bartley Assignee: Gabby Asuncion
Resolution: Done Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by GODRIVER-2186 Format Astrolabe events.json with new... Backlog
Duplicate
is duplicated by GODRIVER-948 Implement pretty printing of extended... Closed
is duplicated by GODRIVER-1809 ExtJSON indent Closed
Related
related to GODRIVER-1809 ExtJSON indent Closed

 Description   

Add functions to marshal to pretty printed Extended JSON and to directly marshal to pretty printed Extended JSON.


Original Issue:

Currently, trying to call json.Marshal on a bson.D results in the document being marshalled as a standard array of structs; i.e. you end up with a JSON array of documents containing "Key" and "Value".

I'm aware that the go driver also supports encoding to extended JSON, and that does work, but it's not as usable because it doesn't support indenting/pretty-printing.



 Comments   
Comment by Githook User [ 02/Nov/21 ]

Author:

{'name': 'Gabriela Asuncion', 'email': 'gabriela.asuncion@mongodb.com', 'username': 'gabbyasuncion'}

Message: GODRIVER-946: Add IndentExtJSON and MarshalExtJSONIndent functions (#781)
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/15ace228e3bfdf37faa31e558d5eb2745a75469f

Comment by David Bartley [ 16/Apr/19 ]

Yes, that would be fine.

Comment by Ian Whalen (Inactive) [ 15/Apr/19 ]

bartle would it also satisfy your request if we added pretty-printing for extended JSON?

Generated at Thu Feb 08 08:35:19 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.