Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


  • 1

Convert Json response


Sinoples

Question

Hello communauty !

 

I work on a REST API and i try to convert this response to array :

[{"authorizationToken":"XXXXXXXXXXX","authorizationId":"XXXXXXXXXXX","buildingId":"2c92808260223f07016025c51f940778","address":{"id":"XXXXXXXXXXX","address":"Cours de Québec, 33300 Bordeaux, France","latitude":44.8788,"longitude":-0.570967,"city":"Bordeaux","county":"Gironde","region":"Nouvelle-Aquitaine","street_name":"Cours de Québec","formatted_address":"Cours de Québec, 33300 Bordeaux, France","p":"33300","c":"France"},"hemis_base_url":"XXxXXXXXt","hemis_stomp_url":"XXXXXXXXXXXXXXXXXX","kernel_slot":"XXXXX","kernel_state":"STARTED","superficy":114,"label":"3272","description":"P3B","floor":"7","stairwell":"1","is_connected":true,"image_url":"https://maps.googleapis.com/maps/api/streetview?size=400x375&location=Cours de Québec, 33300 Bordeaux, France","type":"appartement","build_period":"2017","project":"P3 DEDICACE ","auth_activated":true,"auth_transfer":true,"auth_hemis_level":"ADVANCED","building_brand":"flexom","nb_hemis_key":2,"owner":{"user_id":"","first_name":"","last_name":"","email":"","user_brand":""},"parentProject":{"id":"2c9280826021d14e016021fea203000b","name":"P3 DEDICACE ","creation_date":1512398823939,"last_update":1512462201001,"description":"","tags":[]}}] 

 

I try to use "Json.decode" statement but it doesn't work because I think the structure is too complex (multi-level table). 

Is there a simple solution to split this character string or do I have to use Patterns?

 

Thank you :)

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Please login or register to see this code.

 

  • Like 1
Link to comment
Share on other sites

  • 0
  • Inquirer
  • I Jgab,

     

    Thank you, simple and efficient :) 

    And thank a lot for your tutos, they helped me well.

    • Like 1
    Link to comment
    Share on other sites

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Answer this question...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    ×
    ×
    • Create New...