Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Creating JSON from EObjects
Creating JSON from EObjects [message #869361] Thu, 03 May 2012 09:37 Go to next message
Arvind Sharma is currently offline Arvind SharmaFriend
Messages: 17
Registered: December 2011
Junior Member
Hi,

I have created a XText grammar for my DSL which is basically in JSON format. I got the EMF model associated with my DSL file.

I can iterate through my model instance and get EObjects for various part of my model file. The question is can i get JSON string from one of these eObjects?

Thanks
Arvind
Re: Creating JSON from EObjects [message #869395 is a reply to message #869361] Thu, 03 May 2012 10:42 Go to previous message
Arvind Sharma is currently offline Arvind SharmaFriend
Messages: 17
Registered: December 2011
Junior Member
Got the answer

XtextResource res = (XtextResource)object.eResource();
System.out.println(res.getSerializer().serialize(object));

Thanks
Arvind
Previous Topic:Validation with the Check Language across multiple files
Next Topic:Global Scoping with ImportUriGlobalScopeProvider
Goto Forum:
  


Current Time: Thu Apr 25 05:29:54 GMT 2024

Powered by FUDForum. Page generated in 0.02809 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top