diff --git a/src/ExprNode.cc b/src/ExprNode.cc
index 89e0117fc3178ab5fbcacbd487b10aea99a592dc..4d6db015955ee2aaa6873c6d5bdfcc2bc023c752 100644
--- a/src/ExprNode.cc
+++ b/src/ExprNode.cc
@@ -7646,9 +7646,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