https://github.com/isghe/java-jsonfromurl
simple example in Java, getting a JSON from URL
https://github.com/isghe/java-jsonfromurl
Last synced: 8 months ago
JSON representation
simple example in Java, getting a JSON from URL
- Host: GitHub
- URL: https://github.com/isghe/java-jsonfromurl
- Owner: isghe
- Created: 2021-05-30T15:09:27.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-11-16T14:34:23.000Z (about 1 year ago)
- Last Synced: 2025-02-16T21:43:01.023Z (10 months ago)
- Language: Java
- Size: 11.7 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Java - jsonFromUrl
from: [simplest-way-to-read-json-from-a-url-in-java](https://stackoverflow.com/a/27028548)
## Install dependencies
### JSON-java
```shell
₿ git clone https://github.com/stleary/JSON-java.git
₿ cd JSON-java/src/main/java
₿ javac org/json/*.java
₿ jar cf json-java.jar org/json/*.class
₿ cd ../../../../
₿ ln -s -i JSON-java/src/main/java/json-java.jar json-java.jar
```
### commons-io-2.17.0
[IOUtils](https://dlcdn.apache.org//commons/io/binaries/commons-io-2.17.0-bin.tar.gz)
```shell
₿ tar xvf commons-io-2.17.0-bin.tar.gz
₿ ln -s -i commons-io-2.17.0/commons-io-2.17.0.jar commons-io-2.17.0.jar
```
# Compile
```shell
₿ . compile.sh
```
# Run
```shell
₿ . run.sh https://jsonplaceholder.typicode.com/users/1 | jq
```
```json
[
{
"fromUrl": {
"website": "hildegard.org",
"address": {
"zipcode": "92998-3874",
"geo": {
"lng": "81.1496",
"lat": "-37.3159"
},
"suite": "Apt. 556",
"city": "Gwenborough",
"street": "Kulas Light"
},
"phone": "1-770-736-8031 x56442",
"name": "Leanne Graham",
"company": {
"bs": "harness real-time e-markets",
"catchPhrase": "Multi-layered client-server neural-net",
"name": "Romaguera-Crona"
},
"id": 1,
"email": "Sincere@april.biz",
"username": "Bret"
},
"index": 1
}
]
```