I am working on a simple API that I want to use for my own client, and to open to the public in the future. I have "Item" objects which can have different "types". The type is a C "typedef enum", for the moment I have :
typedef enum {
ItemTypeBool,
ItemTypeNumber,
ItemTypeDate,
} ItemType;
(I may add some in the future)
I am wondering if I should rather transfer it as integers or as defined "strings". The JSON would be :
For integers :
{
"name": "The name",
"type": 0,
...
}
For strings :
{
"name": "The name"
"type": "boolean"
...
}
I'm wondering if there's a best practice for this. Keeping the integer would slightly simplify the code, and reduce the bandwidth, but strings would be easier for developers to remember. I remember I worked on a project, and I had to remember 1=image, 2=audio, 3=html,... which doesn't make any real sense.
So I'm asking you, if you know any other aspect I should consider.