JSON version 1.5.3

LDtk saves its data in pure JSON format: a very easy to use standard which is supported by most modern frameworks. You can learn more about the LDtk format in the documentation.

JSON structure overview

All changes from this version only relate to internal values only used by the LDtk app. That means you can safely ignore them.

The grayed out lines are fields that are only used internally by the LDtk app. You can safely ignore them.

-->

Planned deprecations

The JSON format evolves on each app update. Sometimes, this means removing some values that are no longer relevant.

The following listing shows these values. If you're working on your own JSON parser, please make sure to update your code before this happens.

Learn more about deprecations rules in the documentation.

'); }); // Iterate all rows var deprecations = []; var jRows = jFull.find("tr"); jRows.each( (i,e)=>{ var jRow = $(e); // Create permalinks on rows var jField = jRow.find("td:first code"); if( jField.length>0 ) { var id = jRow.closest(".block").find("a[id]:first").attr("id"); var fieldId = jField.text(); jRow.attr("field", fieldId ); var jPerma = $(''); jPerma.attr("href", "#"+id+";"+fieldId); jPerma.click( (ev)=>{ ev.preventDefault(); gotoHash( id, fieldId ); }); jPerma.appendTo( jRow.find("td:first") ); } // Parse deprecated data var keyword = "deprecated value"; var jLastCell = jRow.find("td:last:contains('"+keyword+"')"); if( jField.length>0 && jLastCell.length>0 ) { // Extract all field details var isInternal = jRow.hasClass("internal"); var section = jRow.closest(".block").find("a[id]:first").attr("id"); var fieldId = jField.text(); // Extract subField for inlined objects var jSubField = jLastCell.find("*:contains('"+keyword+"'):not(:has(:contains('"+keyword+"')))"); var subField = null; if( jSubField.length>0 ) { subField = jSubField.find("code:first").text(); if( subField==fieldId ) subField = null; } // Extract version of deprecation deadline var regStr = "([0-9]+\.[0-9]+(\.[0-9]+|))"; if( subField!=null ) regStr = "("+subField+".*?"+keyword+".*?)" + regStr; else regStr = "("+keyword+".*?)" + regStr; const verReg = new RegExp(regStr, "gmi"); var result = verReg.exec( jLastCell.text() ); if( result ) { var verStr = result[2]; var parsedVer = parseVersion(verStr); deprecations.push({ section:section, fieldId:fieldId, ver:parsedVer, internal:isInternal, subField:subField }); } } }); // Parse current official JSON version var curJsonVerRaw = '1.5.3'; var curJsonVer = parseVersion(curJsonVerRaw); // List deprecations deprecations.sort( function(a,b) { if( a.ver.indexWithPatch < b.ver.indexWithPatch ) return 1; if( a.ver.indexWithPatch > b.ver.indexWithPatch ) return -1; return 0; }); var jDeprecations = $("#deprecations"); var jList = $('
'); jList.appendTo(jDeprecations); if( deprecations.length==0 ) jList.append("There is no removal planned. Woohoo!"); for(const d of deprecations) { var jDepr = $('
'); jDepr.appendTo(jList); var jVer = $('
'); if( d.ver.indexNoPatch==curJsonVer.indexNoPatch ) { jVer.find("span").text( 'Recently removed in '+d.ver.raw ); jVer.addClass("recent"); } else if( d.ver.indexNoPatch>curJsonVer.indexNoPatch ) { jVer.find("span").text( 'Will be removed in '+d.ver.raw ); jVer.addClass("future"); } else { jVer.find("span").text( 'Removed since '+d.ver.raw ); jVer.addClass("past"); } jDepr.append(jVer); jDepr.append('
'+d.section+'
'); jDepr.append('
'+d.fieldId+'
'); if( d.subField!=null ) jDepr.find(".field").append("."+d.subField); if( d.internal ) jDepr.addClass("internal"); (function(section, field) { jDepr.click( ()=>{ gotoHash(section, field); }); })(d.section, d.fieldId); } // Add custom sections to menu var jCustoms = $("#page #customSections>div"); $( jCustoms.get().reverse() ).each( (i,e)=>{ var jCustom = $(e); var id = jCustom.attr("id"); // Move content jFull.append( jCustom ); jCustom.attr("id","block_"+id); jCustom.addClass(id); jCustom.prepend(''); // Create menu link var jLink = $(''+jCustom.attr("label")+''); jLink.attr("id","link_"+id); jLink.attr("targetId",id); jLink.prependTo(jMenuItems); jLink.click( (ev)=>{ gotoHash(id); ev.preventDefault(); }); }); // "Show internals" checkbox jShowInternals.change( ()=>applyShowInternals() ); jShowInternals.change(); // Parse versions from badges var versions = []; var versionChanges = {}; var dones = {}; var jAllBadges = jFull.find('img[src*="shields.io"]'); jAllBadges.each( function(i,e) { var jBadge = $(this); var match = /_([0-9.]+)-/gi.exec( jBadge.attr("src") ); if( match!=null ) { var ver = match[1]; var isInternal = jBadge.closest("tr.internal").length!=0; var change = "?"; if( jBadge.attr("src").indexOf("Added")>=0 ) change = "add"; else if( jBadge.attr("src").indexOf("Changed")>=0 ) change = "change"; else if( jBadge.attr("src").indexOf("Removed")>=0 ) change = "remove"; // Field name if( jBadge.closest("tr").length>0 ) { var field = jBadge.closest("tr").find(">td:first code").text(); var section = jBadge.closest(".block").find("h2:first").text(); section = section.substr( section.lastIndexOf(".")+1 ); var id = jBadge.closest(".block").find("a[id]").first().attr("id"); var subField = jBadge.parent().find("code:first").text(); if( subField==field ) subField = null; var internal = jBadge.closest("tr").hasClass("internal"); if( !versionChanges[ver] ) versionChanges[ver] = []; versionChanges[ver].push({ id:id, section:section, field:field, subField:subField, change:change, internal:internal }); } // Store unique version numbers if( !dones[ver] ) { versions.push(ver); dones[ver] = true; } } }); versions.sort(function(a,b) { if( ab ) return -1; return 0; }); // Fill versions select var jVersionSelect = jFull.find(".changes select"); for(const v of versions) { var changes = versionChanges[v]; var n = changes==null ? 0 : changes.length; jVersionSelect.append(''); } jVersionSelect.change( (ev)=>{ var v = ev.target.value; var jChanges = $(ev.target).parent().find(".allChanges"); jChanges.find(".change").remove(); if( v=="" ) return; var changes = versionChanges[v]; for(c of changes) { var changeLabel = "?"; switch(c.change) { case "add" : changeLabel = "Added"; break; case "remove" : changeLabel = "Removed"; break; case "change" : changeLabel = "Changed"; break; } var jChange = $('
'); if( c.internal ) jChange.addClass("internal"); jChange.appendTo(jChanges); jChange.append('
'+changeLabel+'
'); jChange.append('
'+c.section+'
'); var fullField = c.field; if( c.subField!=null ) fullField+="."+c.subField; var jField = $('
'+fullField+'
'); jChange.append(jField); if( c.internal ) jField.append('(internal editor value)'); (function(id, field) { jChange.click( ()=>{ gotoHash(id, field); }); })(c.id, c.field); } if( skipSelectUrlChange ) skipSelectUrlChange = false; else window.location.hash = window.location.hash.split(";")[0].substr(1) +";"+ v ; applyShowInternals(); }); // Open relevant section if( window.location.hash ) { // Use hash from URL var h = window.location.hash.split(";"); if( h.length==1 ) openSection( h[0].substr(1) ); else openSection( h[0].substr(1), h[1] ); } else { // Open first by default openDefaultSection(); } } );