Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7742669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T09:20:00+00:00 2026-06-01T09:20:00+00:00

I have a JSON that contains the following: {p1:{debris:{titanium:0,silicum:0}},p2:{debris:{titanium:0,silicum:0}}… I declare the data using

  • 0

I have a JSON that contains the following:

{"p1":{"debris":{"titanium":0,"silicum":0}},"p2":{"debris":{"titanium":0,"silicum":0}}...

I declare the data using HashMap:

public class Galax  {

    public HashMap <String, InnerObject> pos;
}

public class InnerObject {

    public Debris debris;
}

public class Debris {

    public double titanium, silicum;
}

And I call the data using this:

        Galax galax = new Gson().fromJson(strGalaxy, Galax.class);
        System.out.println(galax.pos.get("p2").debris.titanium);

The problem is that I always get NullPointerException when trying to show the data in the log… I do not understand why, because I use do it exactly the same way to get data of other JSON and it works perfectly…

What can be the problem?

Thank you in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T09:20:02+00:00Added an answer on June 1, 2026 at 9:20 am

    I see “pos” in the code but not in the JSON string. official answer. 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a variable that contains the following JSON string: { 0 : Jun
I have a text file that contains cached data in JSON format. I'm trying
I have a JSON result in PHP that looks like the following: [{attributes:{type:Manager__c,url:/services/data/v23.0/sobjects/Manager__c/a03U00000015ay6IAA},Id:a03U00000015ay6IAA,Name:ManagerID-00003}, {attributes:{type:Manager__c,url:/services/data/v23.0/sobjects/Manager__c/a03U00000015ZfJIAU},Id:a03U00000015ZfJIAU,Name:ManagerID-00001},
I have the following class which contains a hard coded URL that never changes:
Hi I have the following class and need to convert the incoming Json using
I have a JSON string that contains some key with the following value: 123.00.
For example lets say I have a JSON object that contains states and cities.
I have a large JSON file that contains A LOT of similar code. It's
I have MySQL database, where I store the following BLOB (which contains JSON object)
I have an array of data that is returned as a JSON response. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.