Factorize reading variable values from JSON

Could do with being integrated in main sources eventually. But URI templates are
not always used in conjuction with JSON.