I think a good practice to reduce complications is to ensure field names have no spaces. For content author readability, you can add the spaces in the Title
field of the field item (think of it like the display name for content authors). Utilizing the Title
field also decreases the likelihood of having to rename fields down the line which can break your application if you haven't accounted for that possibility.
Because Layout service will not do anything with the field names when responding to any item request, you will be seeing field name in JSON response. It's basically our design to define an appropriate name(s) for fields. As per your ex- if you created a field with name Page Title
then it will be returned as "Page Title".
Layout Service will only serialize field values and return appropriately. Each and every field type is having it's own serialization logic to return value in Layout service JSON.
Hope this helps.
/sitecore/api/layout/render/jss?lang=en&sc_apikey={YOUR_KEY}&item=%2F
. Take a look at the field names in there. You certainly can use spaces in your field template names, but it all depends on how you have everything set up.