Ali Ahmadi
Ali Ahmadi

Reputation: 89

How to get json as a string from a url?

I want to have an array with the value of json:

arr[ ] array = {"http://www.ip-api.com/json"};

when I print this array, how can I have json but not "http://www.ip-api.com/json" as a string?

Upvotes: 0

Views: 59

Answers (1)

Tim B
Tim B

Reputation: 41168

Use a JSON generating library such as Jackson and have it serialize the data structure.

https://github.com/FasterXML/jackson

If you want to actually mean that you want to call the service at that URL then you need to use a suitable library for that...

Upvotes: 1

Related Questions