         }
         
         // Replace root object with newly created n-level dictionary
-        replacementDictionary.setValue(object, forKeyPath: forKeyPath);
+        replacementDictionary.setValue(object, forKeyPath: primaryKeypath);
         onObject.setObject(replacementDictionary.objectForKey(rootKey), forKey: rootKey);
     }
 }

    }
    
    
    private func codifySwift(expandedStructure : NSDictionary, var contentLevel : Int = 0) -> String {
        
        // Increase content level
        contentLevel++
        
        // Prepare output structure
        var outputStructure : [String] = []

        
        var counter = 0
        var methodHeaderParams = methodSpecification.reduce("") { (string, character) -> String in
            counter += 1
            return "\(string), _ value\(counter) : \(self.dataTypeFromSpecialCharacter(character, language: .Swift))"
        }
        
