RESTful Sensor attributes

Is there possibility to add attributes to the rest sensor like some native sensors have? For instance coinmarketcap sensor have these kind of attributes.
CoinMarketCap

I know that there is setting json_attributes, but this did not behave like I expected.

Let’s say my json is like this:
{"_id":"5a207f74e87cf540c6f2e5b6","value":34.1027,"amount":"854.7040","measurement_id":"home/el/supplier/cost","first_valuetime":"2017-12-01T00:00:00+02:00","last_valuetime":"2017-12-31T23:59:59+02:00"}

where sensor value is value and then I would like to see other entities like amount, first_valuetime and last_valuetime as a attributes. I tried it by following way:

- platform: rest
  resource: http://localhost:3000/cost/previous/month/sum
  name: Previous month bill
  value_template: '{{value_json.value}}'
  unit_of_measurement: "€"
  json_attributes:
  - amount
  - first_valuetime
  - last_valuetime

Is this possible to achieve by RESTful sensor?

Your identation is wrong, your last list should be:

  json_attributes:
    - amount
    - first_valuetime
    - last_valuetime

I think that is acceptable YAML.

Which version of homeassistant are you on? The attribute breakout is a fairly recent addition.

I am using 0.59.2 version of Home Assistant and it is starting correctly without errors. I agree that indentation looks weird on my post. Maybe this was copy&paste error, sorry about this.

Still I cannot reach json_attributes by template like this {{ states.sensor.previous_month_bill.attributes }}
I am getting attributes, but without json_attributes:
{'unit_of_measurement': '€', 'friendly_name': 'Edellisen kuukauden kertymä', 'icon': 'mdi:currency-eur'}

If I understood documention right, for instance get access to amount attribute should be work like this: {{ states.sensor.previous_month_bill.attributes["amount"] }}

I think json_attributes was added in 0.60

You are absolutely correct. This was introduced on 0.60 in pull request https://github.com/home-assistant/home-assistant/pull/10753
I updated to 0.60.1 and now this is working like expected.