[Answer]-How to return the latest object inserted in Django?

1👍

If you want to output the field value of the instance then pass this field to the dumps() instead of the whole object:

json.dumps(str(reading.reading))

You can also omit the str() call if you want to return a number instead of a string:

json.dumps(reading.reading)

Leave a comment