diff --git a/src/ExprNode.cc b/src/ExprNode.cc
index c8090afbb9d11f5f1f527063c10558b3098c8447..ac0f8dac9b4072e4c3d97d9824c01aeebef201b5 100644
--- a/src/ExprNode.cc
+++ b/src/ExprNode.cc
@@ -7321,9 +7321,18 @@ ExternalFunctionNode::writeJsonOutput(ostream &output,
       return;
     }
 
-  output << datatree.symbol_table.getName(symb_id) << "(";
-  writeJsonExternalFunctionArguments(output, temporary_terms, tef_terms, isdynamic);
-  output << ")";
+  try
+    {
+      int tef_idx = getIndxInTefTerms(symb_id, tef_terms);
+      output << "TEF_" << tef_idx;
+    }
+  catch (UnknownFunctionNameAndArgs &)
+    {
+      // When writing the JSON output at parsing pass, we don’t use TEF terms
+      output << datatree.symbol_table.getName(symb_id) << "(";
+      writeJsonExternalFunctionArguments(output, temporary_terms, tef_terms, isdynamic);
+      output << ")";
+    }
 }
 
 void