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 7804575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T01:57:40+00:00 2026-06-02T01:57:40+00:00

I want to Encode EXTjs Class to Json, But, I can’t.. I use JSON.stringify,

  • 0

I want to Encode EXTjs Class to Json, But, I can’t..

I use JSON.stringify, but that gives Exception with Type error.

How can I do that?

Thanks and Here my Code.

Ext.define('Text',{
    extend : 'Ext.Img',
    x : 50,
    y : 50,
    size : 100,
    text : 'Text',
    name : 'Text',
    src : ' ',
    tag : '',
    Events : []
});

var text = new Text();
var temp = JSON.stringify(text);
  • 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-02T01:57:42+00:00Added an answer on June 2, 2026 at 1:57 am

    The problem here is that ExtJS creates internal references on the objects, which turn out to be cyclical. Thus, the default JSON serializer fails.

    You need to manually define a toJSON method which will be called by JSON.stringify:

    Ext.define('Text', {
        extend : 'Ext.Img',
        x : 50,
        y : 50,
        size : 100,
        text : 'Text',
        name : 'Text',
        src : ' ',
        tag : '',
        Events : [],
    
        toJSON: function () {
            return 'Whatever you like' + this.text + this.size // etc.
        }
    
    });
    
    JSON.stringify(new Text()); // "Whatever you likeText100"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use OpenSSL to encryt a string. After that I want to encode the
I want to encode and decode Bitmap object in string base64 . I use
I want to use the Html.Encode by replacing Name <%=Html.TextBox(Name, Model.projectModel.Name)%> However, since i`m
i have a HTML page that want to encode it so could not decode
I want to fire event in custom class written in Extjs 4. I created
I have a long string that I want to encode to ascii. I'm doing:
I'm using as3corelib to decode/encode JSON strings. In my little experiment I want to
I have a group of H.264 images (I-frames only) that I want to encode
$str = preg_replace('\(look: (.{1,80})\)'Ui, (look: <a href=\dict.php?process=word&q=\\1\>\\1</a>),$str); i want to encode url, but how
I want to use the URLEncoder/URLDecoder class (java.net.URLEncoder/URLDecoder) in an application and the methods

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.