public static Map<String,Object> readJsonModel(File jsFile) throws IOException {
  try (BufferedReader reader=new BufferedReader(new FileReader(jsFile))){
    String line=null;
    while ((line=reader.readLine()) != null) {
      if ((line.startsWith("ex$.$CCMM$=") || line.startsWith("var $CCMM$=") || line.startsWith("var $$METAMODEL$$=")|| line.startsWith("var $$metamodel$$=")) && line.endsWith("};")) {
        line=line.substring(line.indexOf("{"),line.length() - 1);
        @SuppressWarnings("unchecked") Map<String,Object> rv=(Map<String,Object>)JSONValue.parse(line);
        return rv;
      }
    }
    return null;
  }
 }

public static Map < String , Object > readJsonModel ( File jsFile ) throws IOException { try ( BufferedReader reader = new BufferedReader ( new FileReader ( jsFile ) ) ) { String line = null ; while ( ( line = reader . readLine ( ) ) != null ) { if ( ( line . startsWith ( "ex$.$CCMM$=" ) || line . startsWith ( "var $CCMM$=" ) || line . startsWith ( "var $$METAMODEL$$=" ) || line . startsWith ( "var $$metamodel$$=" ) ) && line . endsWith ( "};" ) ) { line = line . substring ( line . indexOf ( "{" ) , line . length ( ) - 1 ) ; @ SuppressWarnings ( "unchecked" ) Map < String , Object > rv = ( Map < String , Object > ) JSONValue . parse ( line ) ; return rv ; } } return null ; } }
find the metamodel declaration in a js file , parse it as a map and return it .
