Code

Opened 4 years ago

Closed 3 years ago

Last modified 3 years ago

#13909 closed (invalid)

Info on using "bare" json module in "Serializing Django Objects"

Reported by: JonathanHayward Owned by: nobody
Component: Documentation Version: 1.2
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description (last modified by gabrielhurley)

http://docs.djangoproject.com/en/dev/topics/serialization/ covers how to serialize certain data, namely QuerySets and other model-based data, but it does not appear to contain or cross-reference how one would use the "bare" json module and json.dumps (not serializers.get_serializer('json')()-created objects) to serialize a basic concoction of one or more strings, numbers, hashes, and lists.

In terms of "information scent", the page is a natural search result for django serialization which people could find if they are looking how to serialize JSON-like data for Ajax use. Ideally that page should cross-reference, or possibly contain, how to do basic serialization to JSON for constructions from strings/numbers/hashes/lists, particularly as what you get from serializers.get_serializer('json')() has an allergic response to being asked to serialize non-iterable data.

Attachments (0)

Change History (3)

comment:1 Changed 4 years ago by gabrielhurley

  • Description modified (diff)
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Summary changed from [Enhancement] Cross-reference to "bare" json module suggested for "Serializing Django Objects" to Info on using "bare" json module in "Serializing Django Objects"
  • Triage Stage changed from Unreviewed to Accepted

A brief explanation and an example would be helpful, since this is a natural place for people to look for this type of information.

comment:2 Changed 3 years ago by ramiro

  • Resolution set to invalid
  • Status changed from new to closed

This paragraph of the report: Ideally that page should cross-reference, or possibly contain, how to do basic serialization to JSON for constructions from strings/numbers/hashes/lists tells me the OP is asking for information about general Python-JSON serialization.

IMHO (un)fortunately there is a limit in the amount of general no-Django specific information we can put in our docs. That kind of information should be in other places (e.g. the simplejson library docs?).

The fact that one of the uses for this is in AJAX mechanisms (and hence related to the web-centric nature of Django) doesn't change the fact that JSON serialization of arbitrary Python models is a more broad topic.

I'm closing this ticket for the reason described above.

Version 0, edited 3 years ago by ramiro (next)

comment:3 Changed 3 years ago by gabrielhurley

Upon further review I'm inclined to agree if only because the page is actually titled "Serializing Django objects".

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.