Android Question creat json string

mhk1368

Member
Hi Can anyone help me to create a string similar to:

json:
 {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [
          -77.034084142948,
          38.909671288923
        ]
      },
      "properties": {
        "phoneFormatted": "(202) 234-7336",
        "phone": "2022347336",
        "address": "1471 P St NW",
        "city": "Washington DC",
        "country": "United States",
        "crossStreet": "at 15th St NW",
        "postalCode": "20005",
        "state": "D.C."
      }
    }
 
Solution
Thanks, I will test it, but can you help me how to make exactly the same top?
This is actually not difficult to do. You should learn and understand how to do it. If you want someone do it for you then it would become a job offer.

Summary:
To create [ items ] you use list ( or array )
To create { items } you use map

teddybear

Well-Known Member
Licensed User
json:
 {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [
          -77.034084142948,
          38.909671288923
        ]
      },
      "properties": {
        "phoneFormatted": "(202) 234-7336",
        "phone": "2022347336",
        "address": "1471 P St NW",
        "city": "Washington DC",
        "country": "United States",
        "crossStreet": "at 15th St NW",
        "postalCode": "20005",
        "state": "D.C."
      }
    }
You have created a json string, what do you want to do?
Here you can parse the string.
 
Upvote 0

mhk1368

Member
Start with:
B4X:
Dim data As Map = CreateMap("type": "Feature", _
    "geometry": _
        CreateMap("type": "Point", "coordinates": Array(-77.03, 38.909)))
Dim s As String = data.As(JSON).ToString
Log(s)
Add a reference to the json library.

The order might be different but it doesn't matter.
Thanks, I will test it, but can you help me how to make exactly the same top?
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
Thanks, I will test it, but can you help me how to make exactly the same top?
This is actually not difficult to do. You should learn and understand how to do it. If you want someone do it for you then it would become a job offer.

Summary:
To create [ items ] you use list ( or array )
To create { items } you use map
 
Upvote 0
Solution
Top