Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

So basically, I want to use .json files to store some data for my waypoints instead of using a .txt file like I do now. Now I have never used a .json file before, only edited one for blocks & items/models etc. I have a List that stores all of my waypoints, what I am wondering is how would I go about saving data to a .json file, then read that data to create a waypoint that is then added to the list. Also the main way I would also like to know is how I would format the file to look a bit like this but for every waypoint created:

 

 

{

  {

      "name": "Whateverthenameis",

      "symbol": "SymbolLetter",

      "properties": [

              "coordinates": [

                      "x": whateverx,

                      "y": whatevery,

                      "z:" whateverz

              ],

              "type": whatevertype,

              "scale": whateverscaleasfloat,

              "shown": whatevershown,

      ],

      "world": "WorldFrom"

  },

}

 

 

You need a json serializer/deserializer, don't try to write such a thing yourself.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

What Draco said. You can try the GSON library from Google, which should already be included in the workspace.

 

Note that .JSON is technically just text with a specific format - it is often used, for example, to serialize data for storage in a database (e.g. MySQL) or to transmit over a network (e.g. for an AJAX operation). The major benefit of it is that it facilitates the serialization of complex objects or arrays as simple text.

  • Author

I am aware I need those, but the main thing I am wondering is how to basically read/write the data from/to the json, and create variables for each read value, then convert that into a waypoint with the values.

I think the specifications here are what you're looking for.

 

In other words, in json you have "objects" (they act more like hashmaps, but still). They are enclosed in curly brackets ({}). Each pair consists of a string (a key/field name), and a value (string representation of your data), with a colon (:) inbetween them. Commas are sometimes used to separate the key-value pairs. Arrays also exist, and are enclosed in brackets ([]). They contain a list of values, separated by commas.

Currently working on a mod to provide support for the Clojure programming language in Minecraft, check it out here.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.