api: change JSON mediatype to include charset

Fix #639.