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

  • SEARCH
  • Home
  • 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 8918245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:42:13+00:00 2026-06-15T05:42:13+00:00

How to get this string and put into String Array or HashMap? Any reference?

  • 0

How to get this string and put into String Array or HashMap? Any reference?

     {
        "code" : 403,
            "errors" : [ {
                "domain" : "global",
                "location" : "Authorization",
                "locationType" : "header",
                "message" : "The domain policy has disabled third-party Drive apps",
                "reason" : "domainPolicy"
            } ],
        "message" : "The domain policy has disabled third-party Drive apps"
     }

====

This is my solution for Jackson:

public class TheErrorModel {
    public int code; 
    public Collection<Error> errors; 
    public String message;

    public TheErrorModel() {
    }

    public TheErrorModel(String json) 
            throws Exception {
        ObjectMapper mapper = new ObjectMapper();
        TheErrorModelother = mapper.readValue(json, TheErrorModel.class);

        this.code = other.code;
        this.errors = other.errors;
        this.message = other.message;
    }
}

class Error {
    public String domain;
    public String location;
    public String locationType; 
    public String message;
    public String reason;
}

TheErrorModel theErrorModel = new TheErrorModel(json);

So I get something like theErrorModel.message 😀

  • 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-15T05:42:15+00:00Added an answer on June 15, 2026 at 5:42 am

    You can try to use GSON http://code.google.com/p/google-gson/ , It is pretty simple to use. You should just create class structure for this json schema.

    import com.google.gson.Gson;
    class YourErrorsJSON{
      private String domain 
      private String location;
      private String locationType; 
      private String message; 
      private String reason 
    }
    
    class YourJSON {
      private int code; 
      private YourErrorsJSON[] errors; 
      private String message;
    }
    Gson gson = new Gson();
    YourJSON obj = gson.fromJson(json, YourJSON.class);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string array abc I put this in a for each loop.
I have this string: 123-456-7 I need to get this string: 1234567 How I
Unsure how to get this string to work correctly. Keeps making my page blank.
I get this error when I try to use time_ago_in_words : Comparison of String
I have this string: B82V16814133260 what would be the most efficient way to get
I want to get 100 and example from this string ?connect:100/username:example/ I searched in
I have next interface public interface IMyInterface { string this[string key] { get; set;
I can't get this to work.. I have an String which I want to
How can I get the value of title1 from this string in a datatable
I have string as abvd.qweqw.sdfs.a=aqwrwewrwerrew . I need to parse this string and get

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.