dimanche 31 juillet 2016

Should we use enums in web json result

For example, I have a web api which return a Json Http respone Body. The fields in JSON is meaningful, but the question is should I use a string to describe it ? or use a int enum?

Example A: { "user_id":123, "sex":"male", "status":"active" }

Example B: { "user_id":123, "sex":1, "status":1 }

which is better? and why?

maybe the Example can save some net flow?




Aucun commentaire:

Enregistrer un commentaire