Update encoding.py

'Type' of message now moved to the top in the JSON message.
Merge pull request #9 from wmiltenburg/patch-2

improve JSON format for easier parsing.