Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
JSON
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Zanetti Alex (Student Com20)
JSON
Commits
48071c5d
Commit
48071c5d
authored
3 years ago
by
Alex
Browse files
Options
Downloads
Patches
Plain Diff
Task 4
parent
e8c15cfa
No related branches found
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
.gitignore
+54
-1
54 additions, 1 deletion
.gitignore
JSON.iml
+0
-14
0 additions, 14 deletions
JSON.iml
pom.xml
+21
-5
21 additions, 5 deletions
pom.xml
src/main/java/GeoShape.java
+3
-3
3 additions, 3 deletions
src/main/java/GeoShape.java
src/main/java/Main.java
+11
-3
11 additions, 3 deletions
src/main/java/Main.java
with
89 additions
and
26 deletions
.gitignore
+
54
−
1
View file @
48071c5d
# Created by https://www.gitignore.io/api/intellij
### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff:
/.idea/
/.idea/
/target/
.idea/workspace.xml
\ No newline at end of file
.idea/tasks.xml
.idea/dictionaries
.idea/vcs.xml
.idea/jsLibraryMappings.xml
# Sensitive or high-churn files:
.idea/dataSources.ids
.idea/dataSources.xml
.idea/dataSources.local.xml
.idea/sqlDataSources.xml
.idea/dynamic.xml
.idea/uiDesigner.xml
# Gradle:
.idea/gradle.xml
.idea/libraries
# Mongo Explorer plugin:
.idea/mongoSettings.xml
## File-based project format:
*.iws
## Plugin-specific files:
# IntelliJ
/out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
### Intellij Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
/target/
*.iml
modules.xml
\ No newline at end of file
This diff is collapsed.
Click to expand it.
JSON.iml
deleted
100644 → 0
+
0
−
14
View file @
e8c15cfa
<?xml version="1.0" encoding="UTF-8"?>
<module
org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule=
"true"
type=
"JAVA_MODULE"
version=
"4"
>
<component
name=
"NewModuleRootManager"
LANGUAGE_LEVEL=
"JDK_15"
>
<output
url=
"file://$MODULE_DIR$/target/classes"
/>
<output-test
url=
"file://$MODULE_DIR$/target/test-classes"
/>
<content
url=
"file://$MODULE_DIR$"
>
<sourceFolder
url=
"file://$MODULE_DIR$/src/main/java"
isTestSource=
"false"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/target"
/>
</content>
<orderEntry
type=
"inheritedJdk"
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
<orderEntry
type=
"library"
name=
"Maven: jakarta.json.bind:jakarta.json.bind-api:1.0.1"
level=
"project"
/>
</component>
</module>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
pom.xml
+
21
−
5
View file @
48071c5d
...
@@ -13,23 +13,39 @@
...
@@ -13,23 +13,39 @@
<maven.compiler.target>
15
</maven.compiler.target>
<maven.compiler.target>
15
</maven.compiler.target>
</properties>
</properties>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-compiler-plugin
</artifactId>
<version>
3.8.1
</version>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<dependencies>
<dependency>
<dependency>
<groupId>
ja
karta
.json.bind
</groupId>
<groupId>
ja
vax
.json.bind
</groupId>
<artifactId>
ja
karta
.json.bind-api
</artifactId>
<artifactId>
ja
vax
.json.bind-api
</artifactId>
<version>
1.0
.1
</version>
<version>
1.0
</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
javax.json
</groupId>
<groupId>
javax.json
</groupId>
<artifactId>
javax.json-api
</artifactId>
<artifactId>
javax.json-api
</artifactId>
<version>
1.1
</version>
<version>
1.1
.4
</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
org.glassfish
</groupId>
<groupId>
org.glassfish
</groupId>
<artifactId>
javax.json
</artifactId>
<artifactId>
javax.json
</artifactId>
<version>
1.1
</version>
<version>
1.1
</version>
</dependency>
</dependency>
<dependency>
<groupId>
org.apache.johnzon
</groupId>
<artifactId>
johnzon-jsonb
</artifactId>
<version>
1.1.4
</version>
</dependency>
</dependencies>
</dependencies>
</project>
</project>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/main/java/GeoShape.java
+
3
−
3
View file @
48071c5d
...
@@ -2,9 +2,9 @@ import java.util.Arrays;
...
@@ -2,9 +2,9 @@ import java.util.Arrays;
public
class
GeoShape
{
public
class
GeoShape
{
p
rivate
static
final
String
TYPE
=
"geoShapes"
;
p
ublic
static
final
String
TYPE
=
"geoShapes"
;
p
rivate
String
type
;
p
ublic
String
type
;
p
rivate
double
[]
coordinates
;
p
ublic
double
[]
coordinates
;
public
GeoShape
(
String
type
,
double
[]
coordinates
)
{
public
GeoShape
(
String
type
,
double
[]
coordinates
)
{
this
.
type
=
type
;
this
.
type
=
type
;
...
...
This diff is collapsed.
Click to expand it.
src/main/java/Main.java
+
11
−
3
View file @
48071c5d
import
javax.json.Json
;
import
javax.json.Json
;
import
javax.json.JsonObject
;
import
javax.json.JsonObject
;
import
javax.json.JsonReader
;
import
javax.json.JsonReader
;
import
javax.json.JsonValue
;
import
javax.json.JsonValue
;
import
javax.json.bind.Jsonb
;
import
javax.json.bind.JsonbBuilder
;
import
java.io.FileNotFoundException
;
import
java.io.FileNotFoundException
;
import
java.io.FileReader
;
import
java.io.FileReader
;
...
@@ -9,12 +12,12 @@ public class Main {
...
@@ -9,12 +12,12 @@ public class Main {
public
static
void
main
(
String
[]
args
)
throws
FileNotFoundException
{
public
static
void
main
(
String
[]
args
)
throws
FileNotFoundException
{
//
Reading
//
Task 2
JsonReader
reader
=
Json
.
createReader
(
new
FileReader
(
"src/main/resources/test.json"
));
JsonReader
reader
=
Json
.
createReader
(
new
FileReader
(
"src/main/resources/test.json"
));
JsonObject
jobj
=
reader
.
readObject
();
JsonObject
jobj
=
reader
.
readObject
();
System
.
out
.
println
(
jobj
);
System
.
out
.
println
(
jobj
);
//
Writing
//
Task 3
JsonObject
writing
=
Json
.
createObjectBuilder
()
JsonObject
writing
=
Json
.
createObjectBuilder
()
.
add
(
"type"
,
"events"
)
.
add
(
"type"
,
"events"
)
...
@@ -52,9 +55,14 @@ public class Main {
...
@@ -52,9 +55,14 @@ public class Main {
.
build
()
.
build
()
).
build
()).
build
()).
build
())
).
build
()).
build
()).
build
())
.
build
();
.
build
();
System
.
out
.
println
(
writing
);
System
.
out
.
println
(
writing
);
//Task 4
GeoShape
geoShape
=
new
GeoShape
(
"geoShapes"
,
new
double
[]{
1000
d
,
223
d
,
121
d
});
Jsonb
jsonb
=
JsonbBuilder
.
create
();
System
.
out
.
println
(
jsonb
.
toJson
(
geoShape
));
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment